Creation of DMTF labs project

This commit is contained in:
Andrew Donald Kennedy 2012-04-10 12:39:28 +01:00
parent 9cd9e4feeb
commit 74b5ef76e7
146 changed files with 2216 additions and 1778 deletions

78
labs/dmtf/pom.xml Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.5.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.labs</groupId>
<artifactId>dmtf</artifactId>
<name>jclouds dmtf domain objects</name>
<description>jclouds implementation of DMTF OVF and CIM domain objects</description>
<packaging>bundle</packaging>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>org.jclouds.dmtf.*;version="${project.version}"</Export-Package>
<Import-Package>
org.jclouds*;version="${project.version}",
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -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";
}

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.HashMap;
import java.util.Map; import java.util.Map;
@ -37,7 +37,7 @@ import javax.xml.namespace.QName;
* &lt;complexType name="cimAnySimpleType" /&gt; * &lt;complexType name="cimAnySimpleType" /&gt;
* </pre> * </pre>
*/ */
@XmlType(name = "cimAnySimpleType", namespace = VCLOUD_CIM_NS) @XmlType(name = "cimAnySimpleType", namespace = CIM_NS)
public class CimAnySimpleType { public class CimAnySimpleType {
@XmlValue @XmlValue

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.bind.annotation.adapters.XmlAdapter;

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.HashMap;
import java.util.Map; import java.util.Map;
@ -35,7 +35,7 @@ import javax.xml.namespace.QName;
* &lt;complexType name="cimBoolean" /&gt; * &lt;complexType name="cimBoolean" /&gt;
* </pre> * </pre>
*/ */
@XmlType(name = "cimBoolean", namespace = VCLOUD_CIM_NS) @XmlType(name = "cimBoolean", namespace = CIM_NS)
public class CimBoolean { public class CimBoolean {
@XmlValue @XmlValue

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -37,7 +37,7 @@ import javax.xml.namespace.QName;
* &lt;complexType name="cimReference" /&gt; * &lt;complexType name="cimReference" /&gt;
* </pre> * </pre>
*/ */
@XmlType(name = "cimReference", namespace = VCLOUD_CIM_NS) @XmlType(name = "cimReference", namespace = CIM_NS)
public class CimReference { public class CimReference {
@XmlAnyElement(lax = true) @XmlAnyElement(lax = true)

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.HashMap; import java.util.HashMap;

View File

@ -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.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,35 +16,27 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; 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.dmtf.DMTFConstants.CIM_RASD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS; import static org.jclouds.dmtf.DMTFConstants.OVF_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.URI;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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.Function;
import com.google.common.base.Objects; 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.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -61,10 +53,9 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
* @author grkvlt@apache.org * @author grkvlt@apache.org
* @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd * @see <a href="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">CIM_ResourceAllocationSettingData</a>
*/ */
@XmlRootElement(name = "Item", namespace = VCLOUD_1_5_NS) @XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = OVF_NS,
@XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = VCLOUD_OVF_NS,
propOrder = { propOrder = {
"address", "address",
"addressOnParent", "addressOnParent",
@ -88,21 +79,23 @@ import com.google.common.collect.Sets;
"resourceType", "resourceType",
"virtualQuantity", "virtualQuantity",
"virtualQuantityUnits", "virtualQuantityUnits",
"weight", "weight"
"links"
} }
) )
public class ResourceAllocationSettingData { public class ResourceAllocationSettingData {
public static Builder builder() { public static Builder<?> builder() {
return new Builder(); return new ConcreteBuilder();
} }
public Builder toBuilder() { public Builder<?> toBuilder() {
return builder().fromResourceAllocationSettingData(this); return builder().fromResourceAllocationSettingData(this);
} }
public static class Builder { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
}
public static class Builder<B extends Builder<B>> {
private String elementName; private String elementName;
private String instanceID; private String instanceID;
@ -125,254 +118,219 @@ public class ResourceAllocationSettingData {
private BigInteger virtualQuantity; private BigInteger virtualQuantity;
private String virtualQuantityUnits; private String virtualQuantityUnits;
private Long weight; private Long weight;
private List<CimString> connections = Lists.newArrayList(); private Set<CimString> connections = Sets.newLinkedHashSet();
private List<CimString> hostResources = Lists.newArrayList(); private Set<CimString> hostResources = Sets.newLinkedHashSet();
private URI href;
private String type; @SuppressWarnings("unchecked")
private Set<Link> links = Sets.newLinkedHashSet(); protected B self() {
return (B) this;
}
/** /**
* @see ResourceAllocationSettingData#getElementName() * @see ResourceAllocationSettingData#getElementName()
*/ */
public Builder elementName(String elementName) { public B elementName(String elementName) {
this.elementName = elementName; this.elementName = elementName;
return this; return self();
} }
/** /**
*@see ResourceAllocationSettingData#getInstanceId() *@see ResourceAllocationSettingData#getInstanceId()
*/ */
public Builder instanceID(String instanceID) { public B instanceID(String instanceID) {
this.instanceID = instanceID; this.instanceID = instanceID;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getCaption() * @see ResourceAllocationSettingData#getCaption()
*/ */
public Builder caption(String caption) { public B caption(String caption) {
this.caption = caption; this.caption = caption;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getDescription() * @see ResourceAllocationSettingData#getDescription()
*/ */
public Builder description(String description) { public B description(String description) {
this.description = description; this.description = description;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getAddress * @see ResourceAllocationSettingData#getAddress
*/ */
public Builder address(String address) { public B address(String address) {
this.address = address; this.address = address;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getAddressOnParent * @see ResourceAllocationSettingData#getAddressOnParent
*/ */
public Builder addressOnParent(String addressOnParent) { public B addressOnParent(String addressOnParent) {
this.addressOnParent = addressOnParent; this.addressOnParent = addressOnParent;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getAllocationUnits * @see ResourceAllocationSettingData#getAllocationUnits
*/ */
public Builder allocationUnits(String allocationUnits) { public B allocationUnits(String allocationUnits) {
this.allocationUnits = allocationUnits; this.allocationUnits = allocationUnits;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#isAutomaticAllocation() * @see ResourceAllocationSettingData#isAutomaticAllocation()
*/ */
public Builder automaticAllocation(Boolean automaticAllocation) { public B automaticAllocation(Boolean automaticAllocation) {
this.automaticAllocation = automaticAllocation; this.automaticAllocation = automaticAllocation;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#isAutomaticDeallocation() * @see ResourceAllocationSettingData#isAutomaticDeallocation()
*/ */
public Builder automaticDeallocation(Boolean automaticDeallocation) { public B automaticDeallocation(Boolean automaticDeallocation) {
this.automaticDeallocation = automaticDeallocation; this.automaticDeallocation = automaticDeallocation;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getConsumerVisibility * @see ResourceAllocationSettingData#getConsumerVisibility
*/ */
public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { public B consumerVisibility(ConsumerVisibility consumerVisibility) {
this.consumerVisibility = consumerVisibility; this.consumerVisibility = consumerVisibility;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getLimit * @see ResourceAllocationSettingData#getLimit
*/ */
public Builder limit(BigInteger limit) { public B limit(BigInteger limit) {
this.limit = limit; this.limit = limit;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getMappingBehavior * @see ResourceAllocationSettingData#getMappingBehavior
*/ */
public Builder mappingBehavior(MappingBehavior mappingBehavior) { public B mappingBehavior(MappingBehavior mappingBehavior) {
this.mappingBehavior = mappingBehavior; this.mappingBehavior = mappingBehavior;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getOtherResourceType * @see ResourceAllocationSettingData#getOtherResourceType
*/ */
public Builder otherResourceType(String otherResourceType) { public B otherResourceType(String otherResourceType) {
this.otherResourceType = otherResourceType; this.otherResourceType = otherResourceType;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getParent * @see ResourceAllocationSettingData#getParent
*/ */
public Builder parent(String parent) { public B parent(String parent) {
this.parent = parent; this.parent = parent;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getPoolID * @see ResourceAllocationSettingData#getPoolID
*/ */
public Builder poolID(String poolID) { public B poolID(String poolID) {
this.poolID = poolID; this.poolID = poolID;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getReservation * @see ResourceAllocationSettingData#getReservation
*/ */
public Builder reservation(BigInteger reservation) { public B reservation(BigInteger reservation) {
this.reservation = reservation; this.reservation = reservation;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getResourceSubType * @see ResourceAllocationSettingData#getResourceSubType
*/ */
public Builder resourceSubType(String resourceSubType) { public B resourceSubType(String resourceSubType) {
this.resourceSubType = resourceSubType; this.resourceSubType = resourceSubType;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getResourceType * @see ResourceAllocationSettingData#getResourceType
*/ */
public Builder resourceType(ResourceType resourceType) { public B resourceType(ResourceType resourceType) {
this.resourceType = resourceType; this.resourceType = resourceType;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getVirtualQuantity * @see ResourceAllocationSettingData#getVirtualQuantity
*/ */
public Builder virtualQuantity(BigInteger virtualQuantity) { public B virtualQuantity(BigInteger virtualQuantity) {
this.virtualQuantity = virtualQuantity; this.virtualQuantity = virtualQuantity;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getVirtualQuantityUnits * @see ResourceAllocationSettingData#getVirtualQuantityUnits
*/ */
public Builder virtualQuantityUnits(String virtualQuantityUnits) { public B virtualQuantityUnits(String virtualQuantityUnits) {
this.virtualQuantityUnits = virtualQuantityUnits; this.virtualQuantityUnits = virtualQuantityUnits;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getWeight * @see ResourceAllocationSettingData#getWeight
*/ */
public Builder weight(Long weight) { public B weight(Long weight) {
this.weight = weight; this.weight = weight;
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getConnections() * @see ResourceAllocationSettingData#getConnections()
*/ */
public Builder connection(CimString connection) { public B connection(CimString connection) {
this.connections.add(checkNotNull(connection, "connection")); this.connections.add(checkNotNull(connection, "connection"));
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getConnections * @see ResourceAllocationSettingData#getConnections
*/ */
public Builder connections(List<CimString> connections) { public B connections(Iterable<CimString> connections) {
this.connections = Lists.newArrayList(checkNotNull(connections, "connections")); this.connections = Sets.newLinkedHashSet(checkNotNull(connections, "connections"));
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getHostResources() * @see ResourceAllocationSettingData#getHostResources()
*/ */
public Builder hostResource(CimString hostResource) { public B hostResource(CimString hostResource) {
this.hostResources.add(checkNotNull(hostResource, "hostResource")); this.hostResources.add(checkNotNull(hostResource, "hostResource"));
return this; return self();
} }
/** /**
* @see ResourceAllocationSettingData#getHostResources * @see ResourceAllocationSettingData#getHostResources
*/ */
public Builder hostResources(List<CimString> hostResources) { public B hostResources(Iterable<CimString> hostResources) {
this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources")); this.hostResources = Sets.newLinkedHashSet(checkNotNull(hostResources, "hostResources"));
return this; return self();
}
/**
* @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<Link> 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 ResourceAllocationSettingData build() { public ResourceAllocationSettingData build() {
return new ResourceAllocationSettingData(elementName, instanceID, caption, description, address, return new ResourceAllocationSettingData(this);
addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, type, href, links);
} }
public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { public B fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
return elementName(in.getElementName()) return elementName(in.getElementName())
.instanceID(in.getInstanceID()) .instanceID(in.getInstanceID())
.caption(in.getCaption()) .caption(in.getCaption())
@ -395,10 +353,7 @@ public class ResourceAllocationSettingData {
.virtualQuantityUnits(in.getVirtualQuantityUnits()) .virtualQuantityUnits(in.getVirtualQuantityUnits())
.weight(in.getWeight()) .weight(in.getWeight())
.connections(in.getConnections()) .connections(in.getConnections())
.hostResources(in.getHostResources()) .hostResources(in.getHostResources());
.type(in.getType())
.href(in.getHref())
.links(Sets.newLinkedHashSet(in.getLinks()));
} }
} }
@ -560,96 +515,80 @@ public class ResourceAllocationSettingData {
} }
} }
// <rasd:Elementname>foo</rasd:ElementName> @XmlElement(name = "ElementName", namespace = CIM_RASD_NS)
@XmlElement(name = "ElementName", namespace = VCLOUD_CIM_RASD_NS)
private String elementName; private String elementName;
@XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "InstanceID", namespace = CIM_RASD_NS)
private String instanceID; private String instanceID;
@XmlElement(name = "Caption", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Caption", namespace = CIM_RASD_NS)
private String caption; private String caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Description", namespace = CIM_RASD_NS)
private String description; private String description;
@XmlElement(name = "Address", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Address", namespace = CIM_RASD_NS)
private String address; private String address;
@XmlElement(name = "AddressOnParent", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "AddressOnParent", namespace = CIM_RASD_NS)
private String addressOnParent; private String addressOnParent;
@XmlElement(name = "AllocationUnits", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "AllocationUnits", namespace = CIM_RASD_NS)
private String allocationUnits; private String allocationUnits;
@XmlElement(name = "AutomaticAllocation", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "AutomaticAllocation", namespace = CIM_RASD_NS)
private Boolean automaticAllocation; private Boolean automaticAllocation;
@XmlElement(name = "AutomaticDeallocation", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "AutomaticDeallocation", namespace = CIM_RASD_NS)
private Boolean automaticDeallocation; private Boolean automaticDeallocation;
@XmlElement(name = "ConsumerVisibility", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "ConsumerVisibility", namespace = CIM_RASD_NS)
private ConsumerVisibility consumerVisibility; private ConsumerVisibility consumerVisibility;
@XmlElement(name = "Limit", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Limit", namespace = CIM_RASD_NS)
private BigInteger limit; private BigInteger limit;
@XmlElement(name = "MappingBehavior", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "MappingBehavior", namespace = CIM_RASD_NS)
private MappingBehavior mappingBehavior; private MappingBehavior mappingBehavior;
@XmlElement(name = "OtherResourceType", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "OtherResourceType", namespace = CIM_RASD_NS)
private String otherResourceType; private String otherResourceType;
@XmlElement(name = "Parent", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Parent", namespace = CIM_RASD_NS)
private String parent; private String parent;
@XmlElement(name = "PoolID", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "PoolID", namespace = CIM_RASD_NS)
private String poolID; private String poolID;
@XmlElement(name = "Reservation", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Reservation", namespace = CIM_RASD_NS)
private BigInteger reservation; private BigInteger reservation;
@XmlElement(name = "ResourceSubType", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "ResourceSubType", namespace = CIM_RASD_NS)
private String resourceSubType; private String resourceSubType;
@XmlElement(name = "ResourceType", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "ResourceType", namespace = CIM_RASD_NS)
private ResourceType resourceType; private ResourceType resourceType;
@XmlElement(name = "VirtualQuantity", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "VirtualQuantity", namespace = CIM_RASD_NS)
private BigInteger virtualQuantity; private BigInteger virtualQuantity;
@XmlElement(name = "VirtualQuantityUnits", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "VirtualQuantityUnits", namespace = CIM_RASD_NS)
private String virtualQuantityUnits; private String virtualQuantityUnits;
@XmlElement(name = "Weight", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Weight", namespace = CIM_RASD_NS)
private Long weight; private Long weight;
@XmlElement(name = "Connection", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "Connection", namespace = CIM_RASD_NS)
private List<CimString> connections = Lists.newArrayList(); private Set<CimString> connections = Sets.newLinkedHashSet();
@XmlElement(name = "HostResource", namespace = VCLOUD_CIM_RASD_NS) @XmlElement(name = "HostResource", namespace = CIM_RASD_NS)
private List<CimString> hostResources = Lists.newArrayList(); private Set<CimString> hostResources = Sets.newLinkedHashSet();
@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<Link> links = Sets.newLinkedHashSet();
private ResourceAllocationSettingData(String elementName, String instanceID, String caption, String description, protected ResourceAllocationSettingData(Builder<?> builder) {
String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation, this.elementName = builder.elementName;
Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, BigInteger limit, this.instanceID = builder.instanceID;
MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, BigInteger reservation, this.caption = builder.caption;
String resourceSubType, ResourceType resourceType, BigInteger virtualQuantity, String virtualQuantityUnits, this.description = builder.description;
Long weight, List<CimString> connections, List<CimString> hostResources, String type, URI href, Set<Link> links) { this.address = builder.address;
this.elementName = elementName; this.addressOnParent = builder.addressOnParent;
this.instanceID = instanceID; this.allocationUnits = builder.allocationUnits;
this.caption = caption; this.automaticAllocation = builder.automaticAllocation;
this.description = description; this.automaticDeallocation = builder.automaticDeallocation;
this.address = address; this.consumerVisibility = builder.consumerVisibility;
this.addressOnParent = addressOnParent; this.limit = builder.limit;
this.allocationUnits = allocationUnits; this.mappingBehavior = builder.mappingBehavior;
this.automaticAllocation = automaticAllocation; this.otherResourceType = builder.otherResourceType;
this.automaticDeallocation = automaticDeallocation; this.parent = builder.parent;
this.consumerVisibility = consumerVisibility; this.poolID = builder.poolID;
this.limit = limit; this.reservation = builder.reservation;
this.mappingBehavior = mappingBehavior; this.resourceSubType = builder.resourceSubType;
this.otherResourceType = otherResourceType; this.resourceType = builder.resourceType;
this.parent = parent; this.virtualQuantity = builder.virtualQuantity;
this.poolID = poolID; this.virtualQuantityUnits = builder.virtualQuantityUnits;
this.reservation = reservation; this.weight = builder.weight;
this.resourceSubType = resourceSubType; this.connections = builder.connections != null ? ImmutableSet.copyOf(builder.connections) : Collections.<CimString>emptySet();
this.resourceType = resourceType; this.hostResources = builder.hostResources != null ? ImmutableSet.copyOf(builder.hostResources) : Collections.<CimString>emptySet();
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.<Link>emptySet();
} }
private ResourceAllocationSettingData() { protected ResourceAllocationSettingData() {
// for JAXB // for JAXB
} }
@ -808,7 +747,6 @@ public class ResourceAllocationSettingData {
/** /**
* A string describing an implementation specific sub-type for this resource. * A string describing an implementation specific sub-type for this resource.
* F
*/ */
public String getResourceSubType() { public String getResourceSubType() {
return resourceSubType; return resourceSubType;
@ -864,8 +802,8 @@ public class ResourceAllocationSettingData {
* The thing to which this resource is connected. For example, a named * The thing to which this resource is connected. For example, a named
* network or switch port. * network or switch port.
*/ */
public List<CimString> getConnections() { public Set<CimString> getConnections() {
return Collections.unmodifiableList(connections); return ImmutableSet.copyOf(connections);
} }
/** /**
@ -886,30 +824,19 @@ public class ResourceAllocationSettingData {
* value(s) to indicate that the requested virtual resource allocation be * value(s) to indicate that the requested virtual resource allocation be
* based on host resources that are identified by element values. * based on host resources that are identified by element values.
*/ */
public List<CimString> getHostResources() { public Set<CimString> getHostResources() {
return Collections.unmodifiableList(hostResources); return ImmutableSet.copyOf(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<Link> getLinks() {
return links != null ? ImmutableSet.copyOf(links) : Collections.<Link>emptySet();
} }
@Override @Override
public String toString() { public String toString() {
return string().toString();
}
public ToStringHelper string() {
return Objects.toStringHelper("") return Objects.toStringHelper("")
.add("elementname", elementName) .add("elementName", elementName)
.add("instanceId", instanceID) .add("instanceID", instanceID)
.add("caption", caption) .add("caption", caption)
.add("description", description) .add("description", description)
.add("address", address) .add("address", address)
@ -930,11 +857,7 @@ public class ResourceAllocationSettingData {
.add("resourceType", resourceType) .add("resourceType", resourceType)
.add("virtualQuantity", virtualQuantity) .add("virtualQuantity", virtualQuantity)
.add("virtualQuantityUnits", virtualQuantityUnits) .add("virtualQuantityUnits", virtualQuantityUnits)
.add("weight", weight) .add("weight", weight);
.add("type", type)
.add("href", href)
.add("links", links)
.toString();
} }
@Override @Override
@ -944,7 +867,7 @@ public class ResourceAllocationSettingData {
automaticAllocation, automaticDeallocation, connections, automaticAllocation, automaticDeallocation, connections,
consumerVisibility, hostResources, limit, mappingBehavior, consumerVisibility, hostResources, limit, mappingBehavior,
otherResourceType, parent, poolID, reservation, resourceSubType, otherResourceType, parent, poolID, reservation, resourceSubType,
resourceType, virtualQuantity, virtualQuantityUnits, weight, type, href, links); resourceType, virtualQuantity, virtualQuantityUnits, weight);
} }
@Override @Override
@ -978,10 +901,7 @@ public class ResourceAllocationSettingData {
equal(this.resourceType, that.resourceType) && equal(this.resourceType, that.resourceType) &&
equal(this.virtualQuantity, that.virtualQuantity) && equal(this.virtualQuantity, that.virtualQuantity) &&
equal(this.virtualQuantityUnits, that.virtualQuantityUnits) && equal(this.virtualQuantityUnits, that.virtualQuantityUnits) &&
equal(this.weight, that.weight) && equal(this.weight, that.weight);
equal(this.type, that.type) &&
equal(this.href, that.href) &&
equal(this.links, that.links);
} }
} }

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.cim;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,12 +16,12 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; 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.dmtf.DMTFConstants.CIM_VSSD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.dmtf.DMTFConstants.OVF_NS;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Date; import java.util.Date;
@ -58,9 +58,9 @@ import com.google.common.collect.Maps;
* *
* @author Adrian Cole * @author Adrian Cole
* @author grkvlt@apache.org * @author grkvlt@apache.org
* @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd * @see <a href="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd">CIM_VirtualSystemSettingData</a>
*/ */
@XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = VCLOUD_OVF_NS, @XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = OVF_NS,
propOrder = { propOrder = {
"automaticRecoveryAction", "automaticRecoveryAction",
"automaticShutdownAction", "automaticShutdownAction",
@ -87,15 +87,18 @@ import com.google.common.collect.Maps;
) )
public class VirtualSystemSettingData { public class VirtualSystemSettingData {
public static Builder builder() { public static Builder<?> builder() {
return new Builder(); return new ConcreteBuilder();
} }
public Builder toBuilder() { public Builder<?> toBuilder() {
return builder().fromVirtualSystemSettingData(this); return builder().fromVirtualSystemSettingData(this);
} }
public static class Builder { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
}
public static class Builder<B extends Builder<B>> {
private String elementName; private String elementName;
private String instanceID; private String instanceID;
@ -119,120 +122,121 @@ public class VirtualSystemSettingData {
private String virtualSystemType; private String virtualSystemType;
private String notes; private String notes;
public Builder elementName(String elementName) { @SuppressWarnings("unchecked")
protected B self() {
return (B) this;
}
public B elementName(String elementName) {
this.elementName = elementName; this.elementName = elementName;
return this; return self();
} }
public Builder instanceID(String instanceID) { public B instanceID(String instanceID) {
this.instanceID = instanceID; this.instanceID = instanceID;
return this; return self();
} }
public Builder caption(String caption) { public B caption(String caption) {
this.caption = caption; this.caption = caption;
return this; return self();
} }
public Builder description(String description) { public B description(String description) {
this.description = description; this.description = description;
return this; return self();
} }
public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) { public B automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) {
this.automaticRecoveryAction = automaticRecoveryAction; this.automaticRecoveryAction = automaticRecoveryAction;
return this; return self();
} }
public Builder automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) { public B automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) {
this.automaticShutdownAction = automaticShutdownAction; this.automaticShutdownAction = automaticShutdownAction;
return this; return self();
} }
public Builder automaticStartupAction(AutomaticStartupAction automaticStartupAction) { public B automaticStartupAction(AutomaticStartupAction automaticStartupAction) {
this.automaticStartupAction = automaticStartupAction; this.automaticStartupAction = automaticStartupAction;
return this; return self();
} }
public Builder automaticStartupActionDelay(BigInteger automaticStartupActionDelay) { public B automaticStartupActionDelay(BigInteger automaticStartupActionDelay) {
this.automaticStartupActionDelay = automaticStartupActionDelay; this.automaticStartupActionDelay = automaticStartupActionDelay;
return this; return self();
} }
public Builder automaticStartupActionSequenceNumber(Long automaticStartupActionSequenceNumber) { public B automaticStartupActionSequenceNumber(Long automaticStartupActionSequenceNumber) {
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber; this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
return this; return self();
} }
public Builder configurationDataRoot(String configurationDataRoot) { public B configurationDataRoot(String configurationDataRoot) {
this.configurationDataRoot = configurationDataRoot; this.configurationDataRoot = configurationDataRoot;
return this; return self();
} }
public Builder configurationFile(String configurationFile) { public B configurationFile(String configurationFile) {
this.configurationFile = configurationFile; this.configurationFile = configurationFile;
return this; return self();
} }
public Builder configurationID(String configurationID) { public B configurationID(String configurationID) {
this.configurationID = configurationID; this.configurationID = configurationID;
return this; return self();
} }
public Builder creationTime(Date creationTime) { public B creationTime(Date creationTime) {
this.creationTime = creationTime; this.creationTime = creationTime;
return this; return self();
} }
public Builder logDataRoot(String logDataRoot) { public B logDataRoot(String logDataRoot) {
this.logDataRoot = logDataRoot; this.logDataRoot = logDataRoot;
return this; return self();
} }
public Builder recoveryFile(String recoveryFile) { public B recoveryFile(String recoveryFile) {
this.recoveryFile = recoveryFile; this.recoveryFile = recoveryFile;
return this; return self();
} }
public Builder snapshotDataRoot(String snapshotDataRoot) { public B snapshotDataRoot(String snapshotDataRoot) {
this.snapshotDataRoot = snapshotDataRoot; this.snapshotDataRoot = snapshotDataRoot;
return this; return self();
} }
public Builder suspendDataRoot(String suspendDataRoot) { public B suspendDataRoot(String suspendDataRoot) {
this.suspendDataRoot = suspendDataRoot; this.suspendDataRoot = suspendDataRoot;
return this; return self();
} }
public Builder swapFileDataRoot(String swapFileDataRoot) { public B swapFileDataRoot(String swapFileDataRoot) {
this.swapFileDataRoot = swapFileDataRoot; this.swapFileDataRoot = swapFileDataRoot;
return this; return self();
} }
public Builder virtualSystemIdentifier(String virtualSystemIdentifier) { public B virtualSystemIdentifier(String virtualSystemIdentifier) {
this.virtualSystemIdentifier = virtualSystemIdentifier; this.virtualSystemIdentifier = virtualSystemIdentifier;
return this; return self();
} }
public Builder virtualSystemType(String virtualSystemType) { public B virtualSystemType(String virtualSystemType) {
this.virtualSystemType = virtualSystemType; this.virtualSystemType = virtualSystemType;
return this; return self();
} }
public Builder notes(String notes) { public B notes(String notes) {
this.notes = notes; this.notes = notes;
return this; return self();
} }
public VirtualSystemSettingData build() { public VirtualSystemSettingData build() {
return new VirtualSystemSettingData(elementName, instanceID, caption, description, automaticRecoveryAction, return new VirtualSystemSettingData(this);
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID,
creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot,
virtualSystemIdentifier, virtualSystemType, notes);
} }
public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) { public B fromVirtualSystemSettingData(VirtualSystemSettingData in) {
return elementName(in.getElementName()) return elementName(in.getElementName())
.instanceID(in.getInstanceID()) .instanceID(in.getInstanceID())
.caption(in.getCaption()) .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; private String elementName;
@XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "InstanceID", namespace = CIM_VSSD_NS)
private String instanceID; private String instanceID;
@XmlElement(name = "Caption", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "Caption", namespace = CIM_VSSD_NS)
private String caption; private String caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "Description", namespace = CIM_VSSD_NS)
private String description; private String description;
@XmlElement(name = "VirtualSystemIdentifier", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "VirtualSystemIdentifier", namespace = CIM_VSSD_NS)
private String virtualSystemIdentifier; private String virtualSystemIdentifier;
@XmlElement(name = "VirtualSystemType", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "VirtualSystemType", namespace = CIM_VSSD_NS)
private String virtualSystemType; private String virtualSystemType;
@XmlElement(name = "AutomaticRecoveryAction", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "AutomaticRecoveryAction", namespace = CIM_VSSD_NS)
private AutomaticRecoveryAction automaticRecoveryAction; private AutomaticRecoveryAction automaticRecoveryAction;
@XmlElement(name = "AutomaticShutdownAction", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "AutomaticShutdownAction", namespace = CIM_VSSD_NS)
private AutomaticShutdownAction automaticShutdownAction; private AutomaticShutdownAction automaticShutdownAction;
@XmlElement(name = "AutomaticStartupAction", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "AutomaticStartupAction", namespace = CIM_VSSD_NS)
private AutomaticStartupAction automaticStartupAction; private AutomaticStartupAction automaticStartupAction;
@XmlElement(name = "AutomaticStartupActionDelay", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "AutomaticStartupActionDelay", namespace = CIM_VSSD_NS)
private BigInteger automaticStartupActionDelay; private BigInteger automaticStartupActionDelay;
@XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = CIM_VSSD_NS)
private Long automaticStartupActionSequenceNumber; private Long automaticStartupActionSequenceNumber;
@XmlElement(name = "ConfigurationDataRoot", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "ConfigurationDataRoot", namespace = CIM_VSSD_NS)
private String configurationDataRoot; private String configurationDataRoot;
@XmlElement(name = "ConfigurationFile", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "ConfigurationFile", namespace = CIM_VSSD_NS)
private String configurationFile; private String configurationFile;
@XmlElement(name = "ConfigurationID", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "ConfigurationID", namespace = CIM_VSSD_NS)
private String configurationID; private String configurationID;
@XmlElement(name = "CreationTime", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "CreationTime", namespace = CIM_VSSD_NS)
private Date creationTime; private Date creationTime;
@XmlElement(name = "LogDataRoot", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "LogDataRoot", namespace = CIM_VSSD_NS)
private String logDataRoot; private String logDataRoot;
@XmlElement(name = "RecoveryFile", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "RecoveryFile", namespace = CIM_VSSD_NS)
private String recoveryFile; private String recoveryFile;
@XmlElement(name = "SnapshotDataRoot", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "SnapshotDataRoot", namespace = CIM_VSSD_NS)
private String snapshotDataRoot; private String snapshotDataRoot;
@XmlElement(name = "SuspendDataRoot", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "SuspendDataRoot", namespace = CIM_VSSD_NS)
private String suspendDataRoot; private String suspendDataRoot;
@XmlElement(name = "SwapFileDataRoot", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "SwapFileDataRoot", namespace = CIM_VSSD_NS)
private String swapFileDataRoot; private String swapFileDataRoot;
@XmlElement(name = "Notes", namespace = VCLOUD_CIM_VSSD_NS) @XmlElement(name = "Notes", namespace = CIM_VSSD_NS)
private String notes; 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, private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description,
AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction, AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction,
AutomaticStartupAction automaticStartupAction, BigInteger automaticStartupActionDelay, AutomaticStartupAction automaticStartupAction, BigInteger automaticStartupActionDelay,
@ -644,26 +672,26 @@ public class VirtualSystemSettingData {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
VirtualSystemSettingData that = VirtualSystemSettingData.class.cast(obj); VirtualSystemSettingData that = VirtualSystemSettingData.class.cast(obj);
return equal(this.elementName, that.elementName) && return equal(this.elementName, that.elementName)
equal(this.instanceID, that.instanceID) && && equal(this.instanceID, that.instanceID)
equal(this.caption, that.caption) && && equal(this.caption, that.caption)
equal(this.description, that.description) && && equal(this.description, that.description)
equal(this.automaticRecoveryAction, that.automaticRecoveryAction) && && equal(this.automaticRecoveryAction, that.automaticRecoveryAction)
equal(this.automaticShutdownAction, that.automaticShutdownAction) && && equal(this.automaticShutdownAction, that.automaticShutdownAction)
equal(this.automaticStartupAction, that.automaticStartupAction) && && equal(this.automaticStartupAction, that.automaticStartupAction)
equal(this.automaticStartupActionDelay, that.automaticStartupActionDelay) && && equal(this.automaticStartupActionDelay, that.automaticStartupActionDelay)
equal(this.automaticStartupActionSequenceNumber, that.automaticStartupActionSequenceNumber) && && equal(this.automaticStartupActionSequenceNumber, that.automaticStartupActionSequenceNumber)
equal(this.configurationDataRoot, that.configurationDataRoot) && && equal(this.configurationDataRoot, that.configurationDataRoot)
equal(this.configurationFile, that.configurationFile) && && equal(this.configurationFile, that.configurationFile)
equal(this.configurationID, that.configurationID) && && equal(this.configurationID, that.configurationID)
equal(this.creationTime, that.creationTime) && && equal(this.creationTime, that.creationTime)
equal(this.logDataRoot, that.logDataRoot) && && equal(this.logDataRoot, that.logDataRoot)
equal(this.recoveryFile, that.recoveryFile) && && equal(this.recoveryFile, that.recoveryFile)
equal(this.snapshotDataRoot, that.snapshotDataRoot) && && equal(this.snapshotDataRoot, that.snapshotDataRoot)
equal(this.suspendDataRoot, that.suspendDataRoot) && && equal(this.suspendDataRoot, that.suspendDataRoot)
equal(this.swapFileDataRoot, that.swapFileDataRoot) && && equal(this.swapFileDataRoot, that.swapFileDataRoot)
equal(this.virtualSystemIdentifier, that.virtualSystemIdentifier) && && equal(this.virtualSystemIdentifier, that.virtualSystemIdentifier)
equal(this.virtualSystemType, that.virtualSystemType); && equal(this.virtualSystemType, that.virtualSystemType);
} }
@Override @Override

View File

@ -16,22 +16,21 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
@XmlSchema(namespace = VCLOUD_CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED, @XmlSchema(namespace = CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), @XmlNs(prefix = "cim", namespaceURI = CIM_NS),
@XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS), @XmlNs(prefix = "ovf", namespaceURI = OVF_NS),
@XmlNs(prefix = "vssd", namespaceURI = VCLOUD_CIM_VSSD_NS), @XmlNs(prefix = "vssd", namespaceURI = CIM_VSSD_NS),
@XmlNs(prefix = "rasd", namespaceURI = VCLOUD_CIM_RASD_NS), @XmlNs(prefix = "rasd", namespaceURI = CIM_RASD_NS)
@XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS)
} }
) )
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.dmtf.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.dmtf.DMTFConstants.CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS; import static org.jclouds.dmtf.DMTFConstants.CIM_RASD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS; import static org.jclouds.dmtf.DMTFConstants.CIM_VSSD_NS;
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.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -30,7 +30,7 @@ import com.google.common.base.Objects;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = { @XmlType(name = "Configuration", namespace = OVF_NS, propOrder = {
"label", "description" "label", "description"
}) })
public class Configuration { public class Configuration {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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; import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.dmtf.ovf;
import java.net.URI; import java.net.URI;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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; import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.XmlRootElement;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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; import static com.google.common.base.Preconditions.checkNotNull;
@ -84,7 +84,7 @@ public class NetworkSection extends SectionType {
private NetworkSection(Builder<?> builder) { private NetworkSection(Builder<?> builder) {
super(builder); super(builder);
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks")); this.networks = ImmutableSet.copyOf(checkNotNull(networks, "networks"));
} }
private NetworkSection() { private NetworkSection() {
@ -94,8 +94,6 @@ public class NetworkSection extends SectionType {
/** /**
* All networks referred to from Connection elements in all {@link VirtualHardwareSection} * All networks referred to from Connection elements in all {@link VirtualHardwareSection}
* elements shall be defined in the NetworkSection. * elements shall be defined in the NetworkSection.
*
* @return
*/ */
public Set<Network> getNetworks() { public Set<Network> getNetworks() {
return networks; return networks;
@ -115,12 +113,14 @@ public class NetworkSection extends SectionType {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
NetworkSection other = (NetworkSection) obj; NetworkSection other = (NetworkSection) obj;
return super.equals(other) && Objects.equal(networks, other.networks); return super.equals(other)
&& Objects.equal(networks, other.networks);
} }
@Override @Override
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return super.string().add("networks", networks); return super.string()
.add("networks", networks);
} }
} }

View File

@ -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<ConcreteBuilder> {
}
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
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);
}
}

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; 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.Collections;
import java.util.Set; 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.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -69,6 +69,12 @@ public class ProductSection extends SectionType {
private CimString appUrl; private CimString appUrl;
protected Set<ProductSectionProperty> properties = Sets.newLinkedHashSet(); protected Set<ProductSectionProperty> properties = Sets.newLinkedHashSet();
@Override
@SuppressWarnings("unchecked")
protected B self() {
return (B) this;
}
/** /**
* @see ProductSection#getProduct() * @see ProductSection#getProduct()
*/ */
@ -190,15 +196,15 @@ public class ProductSection extends SectionType {
private MsgType product; private MsgType product;
@XmlElement(name = "Vendor") @XmlElement(name = "Vendor")
private MsgType vendor; private MsgType vendor;
@XmlElement(name = "Version", namespace = VCLOUD_CIM_NS) @XmlElement(name = "Version", namespace = CIM_NS)
private CimString version; private CimString version;
@XmlElement(name = "FullVersion", namespace = VCLOUD_CIM_NS) @XmlElement(name = "FullVersion", namespace = CIM_NS)
private CimString fullVersion; private CimString fullVersion;
@XmlElement(name = "ProductUrl", namespace = VCLOUD_CIM_NS) @XmlElement(name = "ProductUrl", namespace = CIM_NS)
private CimString productUrl; private CimString productUrl;
@XmlElement(name = "VendorUrl", namespace = VCLOUD_CIM_NS) @XmlElement(name = "VendorUrl", namespace = CIM_NS)
private CimString vendorUrl; private CimString vendorUrl;
@XmlElement(name = "AppUrl", namespace = VCLOUD_CIM_NS) @XmlElement(name = "AppUrl", namespace = CIM_NS)
private CimString appUrl; private CimString appUrl;
@XmlElement(name = "Property") @XmlElement(name = "Property")
private Set<ProductSectionProperty> properties = Sets.newLinkedHashSet(); private Set<ProductSectionProperty> properties = Sets.newLinkedHashSet();

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.XmlAttribute;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,23 +16,16 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType; 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; import com.google.common.base.Objects;
/** /**
@ -45,21 +38,6 @@ import com.google.common.base.Objects;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlType(name = "Section_Type") @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 abstract class SectionType {
public static abstract class Builder<B extends Builder<B>> { public static abstract class Builder<B extends Builder<B>> {
@ -112,7 +90,7 @@ public abstract class SectionType {
@XmlElement(name = "Info", required = true) @XmlElement(name = "Info", required = true)
private String info; private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS) @XmlAttribute(namespace = OVF_NS)
private Boolean required; private Boolean required;
protected SectionType(Builder<?> builder) { protected SectionType(Builder<?> builder) {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -16,24 +16,20 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; 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 java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; import org.jclouds.dmtf.cim.VirtualSystemSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -71,12 +67,9 @@ public class VirtualHardwareSection extends SectionType {
private VirtualSystemSettingData virtualSystem; private VirtualSystemSettingData virtualSystem;
private String transport; private String transport;
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet(); private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
/** /**
* @see VirtualHardwareSection#getSystem * @see VirtualHardwareSection#getSystem()
*/ */
public B system(VirtualSystemSettingData virtualSystem) { public B system(VirtualSystemSettingData virtualSystem) {
this.virtualSystem = virtualSystem; this.virtualSystem = virtualSystem;
@ -123,38 +116,6 @@ public class VirtualHardwareSection extends SectionType {
return self(); return self();
} }
/**
* @see VirtualHardwareSection#getLinks()
*/
public B links(Set<Link> 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} * {@inheritDoc}
*/ */
@ -167,38 +128,25 @@ public class VirtualHardwareSection extends SectionType {
return fromSectionType(in) return fromSectionType(in)
.items(in.getItems()) .items(in.getItems())
.transport(in.getTransport()) .transport(in.getTransport())
.system(in.getSystem()) .system(in.getSystem());
.links(Sets.newLinkedHashSet(in.getLinks()))
.href(in.getHref())
.type(in.getType());
} }
} }
@XmlElement(name = "System") @XmlElement(name = "System")
private VirtualSystemSettingData virtualSystem; protected VirtualSystemSettingData virtualSystem;
@XmlAttribute(name = "transport") @XmlAttribute(name = "transport")
private String transport; protected String transport;
@XmlElement(name = "Item") @XmlElement(name = "Item")
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet(); protected Set<? extends ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute(namespace = VCLOUD_1_5_NS)
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute(namespace = VCLOUD_1_5_NS)
protected String type;
private VirtualHardwareSection(Builder<?> builder) { protected VirtualHardwareSection(Builder<?> builder) {
super(builder); super(builder);
this.virtualSystem = builder.virtualSystem; this.virtualSystem = builder.virtualSystem;
this.transport = builder.transport; this.transport = builder.transport;
this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Sets.<ResourceAllocationSettingData>newLinkedHashSet(); this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Sets.<ResourceAllocationSettingData>newLinkedHashSet();
this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Sets.<Link>newLinkedHashSet();
this.href = builder.href;
this.type = builder.type;
} }
private VirtualHardwareSection() { protected VirtualHardwareSection() {
// For JAXB // For JAXB
} }
@ -229,36 +177,13 @@ public class VirtualHardwareSection extends SectionType {
return virtualSystem; return virtualSystem;
} }
public Set<ResourceAllocationSettingData> getItems() { public Set<? extends ResourceAllocationSettingData> getItems() {
return ImmutableSet.copyOf(items); return ImmutableSet.copyOf(items);
} }
/**
* Gets the value of the link property.
*/
public Set<Link> 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 @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), transport, virtualSystem, items, links, href, type); return Objects.hashCode(super.hashCode(), transport, virtualSystem, items);
} }
@Override @Override
@ -267,17 +192,17 @@ public class VirtualHardwareSection extends SectionType {
if (obj == null) return false; if (obj == null) return false;
if (getClass() != obj.getClass()) return false; if (getClass() != obj.getClass()) return false;
VirtualHardwareSection that = VirtualHardwareSection.class.cast(obj); VirtualHardwareSection that = VirtualHardwareSection.class.cast(obj);
return super.equals(that) && return super.equals(that)
equal(this.transport, that.transport) && && equal(this.transport, that.transport)
equal(this.virtualSystem, that.virtualSystem) && && equal(this.virtualSystem, that.virtualSystem)
equal(this.items, that.items) && && equal(this.items, that.items);
equal(this.links, that.links) &&
equal(this.href, that.href) &&
equal(this.type, that.type);
} }
@Override @Override
protected Objects.ToStringHelper string() { 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);
} }
} }

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Map;
import java.util.Set; import java.util.Set;
@ -54,11 +54,11 @@ import com.google.common.collect.Sets;
@XmlType(name = "Entity_Type") @XmlType(name = "Entity_Type")
public class EntityType { public class EntityType {
@XmlElementRef(name = "Section", namespace = VCLOUD_OVF_ENV_NS) @XmlElementRef(name = "Section", namespace = OVF_ENV_NS)
protected Set<SectionType<?>> sections = Sets.newLinkedHashSet(); protected Set<SectionType<?>> sections = Sets.newLinkedHashSet();
@XmlAnyElement(lax = true) @XmlAnyElement(lax = true)
protected Set<Object> any = Sets.newLinkedHashSet(); protected Set<Object> any = Sets.newLinkedHashSet();
@XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) @XmlAttribute(namespace = OVF_ENV_NS, required = true)
protected String id; protected String id;
@XmlAnyAttribute @XmlAnyAttribute
private Map<QName, String> otherAttributes = Maps.newLinkedHashMap(); private Map<QName, String> otherAttributes = Maps.newLinkedHashMap();

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Map;
import java.util.Set; import java.util.Set;
@ -56,13 +56,13 @@ import com.google.common.collect.Sets;
@XmlType(name = "Environment_Type") @XmlType(name = "Environment_Type")
public class EnvironmentType { public class EnvironmentType {
@XmlElementRef(name = "Section", namespace = VCLOUD_OVF_ENV_NS) @XmlElementRef(name = "Section", namespace = OVF_ENV_NS)
protected Set<SectionType<?>> sections = Sets.newLinkedHashSet(); protected Set<SectionType<?>> sections = Sets.newLinkedHashSet();
@XmlElement(name = "Entity") @XmlElement(name = "Entity")
protected Set<EntityType> entities = Sets.newLinkedHashSet(); protected Set<EntityType> entities = Sets.newLinkedHashSet();
@XmlAnyElement(lax = true) @XmlAnyElement(lax = true)
protected Set<Object> any = Sets.newLinkedHashSet(); protected Set<Object> any = Sets.newLinkedHashSet();
@XmlAttribute(namespace = VCLOUD_OVF_ENV_NS) @XmlAttribute(namespace = OVF_ENV_NS)
protected String id; protected String id;
@XmlAnyAttribute @XmlAnyAttribute
private Map<QName, String> otherAttributes = Maps.newLinkedHashMap(); private Map<QName, String> otherAttributes = Maps.newLinkedHashMap();

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; package org.jclouds.dmtf.ovf.environment;
import java.util.Set; 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.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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.base.Objects;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.HashMap;
import java.util.Map; import java.util.Map;
@ -34,9 +34,9 @@ import javax.xml.namespace.QName;
@XmlType(name = "") @XmlType(name = "")
public class Property { public class Property {
@XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) @XmlAttribute(namespace = OVF_ENV_NS, required = true)
protected String key; protected String key;
@XmlAttribute(namespace = VCLOUD_OVF_ENV_NS, required = true) @XmlAttribute(namespace = OVF_ENV_NS, required = true)
protected String value; protected String value;
@XmlAnyAttribute @XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>(); private Map<QName, String> otherAttributes = new HashMap<QName, String>();

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; package org.jclouds.dmtf.ovf.environment;
import java.util.Set; import java.util.Set;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf.environment; package org.jclouds.dmtf.ovf.environment;
import java.util.Map; import java.util.Map;

View File

@ -16,19 +16,20 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
@XmlSchema(namespace = VCLOUD_OVF_ENV_NS, @XmlSchema(namespace = OVF_ENV_NS,
elementFormDefault = XmlNsForm.QUALIFIED, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), @XmlNs(prefix = "cim", namespaceURI = CIM_NS),
@XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS) @XmlNs(prefix = "ovf", namespaceURI = OVF_NS),
@XmlNs(prefix = "env", namespaceURI = OVF_ENV_NS)
} }
) )
@XmlAccessorType(XmlAccessType.FIELD) @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.dmtf.DMTFConstants.CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_ENV_NS; import static org.jclouds.dmtf.DMTFConstants.OVF_ENV_NS;
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.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;

View File

@ -16,15 +16,15 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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 static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set; import java.util.Set;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection; import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
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;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -32,80 +32,87 @@ import com.google.common.collect.Sets;
/** /**
* @author Adrian Cole * @author Adrian Cole
* @author grkvlt@apache.org
*/ */
public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEnvelope<V, E>> { public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEnvelope<V, E>> {
// FIXME Fix builder pattern used
public abstract Builder<V, E> toBuilder(); public abstract Builder<?, V, E> toBuilder();
public static abstract class Builder<B extends Builder<B, V, E>, V extends BaseVirtualSystem, E extends BaseEnvelope<V, E>> {
public static abstract class Builder<V extends BaseVirtualSystem, E extends BaseEnvelope<V, E>> {
protected Set<DiskSection> diskSections = Sets.newLinkedHashSet(); protected Set<DiskSection> diskSections = Sets.newLinkedHashSet();
protected Set<NetworkSection> networkSections = Sets.newLinkedHashSet(); protected Set<NetworkSection> networkSections = Sets.newLinkedHashSet();
protected Set<SectionType> additionalSections = Sets.newLinkedHashSet(); protected Set<SectionType> additionalSections = Sets.newLinkedHashSet();
protected V virtualSystem; protected V virtualSystem;
@SuppressWarnings("unchecked")
protected B self() {
return (B) this;
}
/** /**
* @see BaseEnvelope#getDiskSections * @see BaseEnvelope#getDiskSections
*/ */
public Builder<V, E> diskSection(DiskSection diskSection) { public B diskSection(DiskSection diskSection) {
this.diskSections.add(checkNotNull(diskSection, "diskSection")); this.diskSections.add(checkNotNull(diskSection, "diskSection"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getDiskSections * @see BaseEnvelope#getDiskSections
*/ */
public Builder<V, E> diskSections(Iterable<? extends DiskSection> diskSections) { public B diskSections(Iterable<? extends DiskSection> diskSections) {
this.diskSections = ImmutableSet.<DiskSection> copyOf(checkNotNull(diskSections, "diskSections")); this.diskSections = ImmutableSet.<DiskSection> copyOf(checkNotNull(diskSections, "diskSections"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getNetworkSections * @see BaseEnvelope#getNetworkSections
*/ */
public Builder<V, E> networkSection(NetworkSection networkSection) { public B networkSection(NetworkSection networkSection) {
this.networkSections.add(checkNotNull(networkSection, "networkSection")); this.networkSections.add(checkNotNull(networkSection, "networkSection"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getNetworkSections * @see BaseEnvelope#getNetworkSections
*/ */
public Builder<V, E> networkSections(Iterable<? extends NetworkSection> networkSections) { public B networkSections(Iterable<? extends NetworkSection> networkSections) {
this.networkSections = ImmutableSet.<NetworkSection> copyOf(checkNotNull(networkSections, "networkSections")); this.networkSections = ImmutableSet.<NetworkSection> copyOf(checkNotNull(networkSections, "networkSections"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getAdditionalSections * @see BaseEnvelope#getAdditionalSections
*/ */
public Builder<V, E> additionalSection(SectionType additionalSection) { public B additionalSection(SectionType additionalSection) {
this.additionalSections.add(checkNotNull(additionalSection, "additionalSection")); this.additionalSections.add(checkNotNull(additionalSection, "additionalSection"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getAdditionalSections * @see BaseEnvelope#getAdditionalSections
*/ */
public Builder<V, E> additionalSections(Iterable<? extends SectionType> additionalSections) { public B additionalSections(Iterable<? extends SectionType> additionalSections) {
this.additionalSections = ImmutableSet.<SectionType> copyOf(checkNotNull(additionalSections, "additionalSections")); this.additionalSections = ImmutableSet.<SectionType> copyOf(checkNotNull(additionalSections, "additionalSections"));
return this; return self();
} }
/** /**
* @see BaseEnvelope#getVirtualSystem * @see BaseEnvelope#getVirtualSystem
*/ */
public Builder<V, E> virtualSystem(V virtualSystem) { public B virtualSystem(V virtualSystem) {
this.virtualSystem = virtualSystem; this.virtualSystem = virtualSystem;
return this; return self();
} }
public abstract E build() ; public abstract E build();
public Builder<V, E> fromEnvelope(BaseEnvelope<V, E> in) { public B fromEnvelope(BaseEnvelope<V, E> in) {
return virtualSystem(in.getVirtualSystem()).diskSections(in.getDiskSections()) return virtualSystem(in.getVirtualSystem())
.networkSections(networkSections).additionalSections(in.getAdditionalSections()); .diskSections(in.getDiskSections())
.networkSections(networkSections)
.additionalSections(in.getAdditionalSections());
} }
} }
@ -115,12 +122,11 @@ public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEn
private Set<SectionType> additionalSections; private Set<SectionType> additionalSections;
private V virtualSystem; private V virtualSystem;
protected BaseEnvelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections, protected BaseEnvelope(Builder<?, V, E> builder) {
Iterable<? extends SectionType> additionalSections, V virtualSystem) { this.diskSections = ImmutableSet.copyOf(checkNotNull(builder.diskSections, "diskSections"));
this.diskSections = ImmutableSet.copyOf(checkNotNull(diskSections, "diskSections")); this.networkSections = ImmutableSet.copyOf(checkNotNull(builder.networkSections, "networkSections"));
this.networkSections = ImmutableSet.copyOf(checkNotNull(networkSections, "networkSections")); this.additionalSections = ImmutableSet.copyOf(checkNotNull(builder.additionalSections, "additionalSections"));
this.additionalSections = ImmutableSet.copyOf(checkNotNull(additionalSections, "additionalSections")); this.virtualSystem = checkNotNull(builder.virtualSystem, "virtualSystem");
this.virtualSystem = checkNotNull(virtualSystem, "virtualSystem");
} }
protected BaseEnvelope() { protected BaseEnvelope() {
@ -134,6 +140,10 @@ public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEn
public Set<? extends DiskSection> getDiskSections() { public Set<? extends DiskSection> getDiskSections() {
return diskSections; return diskSections;
} }
public Set<NetworkSection> getNetworkSections() {
return networkSections;
}
public Set<SectionType> getAdditionalSections() { public Set<SectionType> getAdditionalSections() {
return additionalSections; return additionalSections;
@ -163,11 +173,10 @@ public abstract class BaseEnvelope<V extends BaseVirtualSystem, E extends BaseEn
} }
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("diskSections", diskSections).add("networkSections", networkSections) return Objects.toStringHelper("")
.add("additionalSections", additionalSections).add("virtualSystem", virtualSystem); .add("diskSections", diskSections)
} .add("networkSections", networkSections)
.add("additionalSections", additionalSections)
public Set<NetworkSection> getNetworkSections() { .add("virtualSystem", virtualSystem);
return networkSections;
} }
} }

View File

@ -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<B extends Builder<B>> extends SectionType.Builder<B> {
private String id;
private String name;
private Set<ProductSection> productSections = Sets.newLinkedHashSet();
private Set<SectionType> 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<? extends ProductSection> 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<? extends SectionType> 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<? extends ProductSection> productSections;
@XmlElementRef
private Set<? extends SectionType> 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<? extends ProductSection> getProductSections() {
return productSections;
}
public Set<? extends SectionType> 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);
}
}

View File

@ -16,17 +16,18 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
@XmlSchema(namespace = VCLOUD_OVF_NS, @XmlSchema(namespace = OVF_NS,
elementFormDefault = XmlNsForm.QUALIFIED, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS) @XmlNs(prefix = "cim", namespaceURI = CIM_NS),
@XmlNs(prefix = "ovf", namespaceURI = OVF_NS)
} }
) )
@XmlAccessorType(XmlAccessType.FIELD) @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.dmtf.DMTFConstants.CIM_NS;
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.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;

View File

@ -16,21 +16,18 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
@XmlSchema(namespace = VCLOUD_OVF_NS, @XmlSchema(namespace = OVF_NS,
elementFormDefault = XmlNsForm.QUALIFIED, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS), @XmlNs(prefix = "cim", namespaceURI = CIM_NS),
@XmlNs(prefix = "vmv", namespaceURI = VCLOUD_VMW_NS), @XmlNs(prefix = "ovf", namespaceURI = OVF_NS)
@XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS)
} }
) )
@XmlAccessorType(XmlAccessType.FIELD) @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.dmtf.DMTFConstants.CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; import static org.jclouds.dmtf.DMTFConstants.OVF_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 javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
For more configuration infromation and examples see the Apache
Log4j website: http://logging.apache.org/log4j/
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
<!-- A time/date based rolling appender -->
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds-wire.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category]
(Thread:NDC) Message\n <param name="ConversionPattern"
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category]
(Thread:NDC) Message\n <param name="ConversionPattern"
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<!-- A time/date based rolling appender -->
<appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds-compute.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category]
(Thread:NDC) Message\n <param name="ConversionPattern"
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<!-- A time/date based rolling appender -->
<appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds-ssh.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category]
(Thread:NDC) Message\n <param name="ConversionPattern"
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="COMPUTEFILE" />
</appender>
<appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="SSHFILE" />
</appender>
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="FILE" />
</appender>
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="WIREFILE" />
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="org.jclouds">
<priority value="DEBUG" />
<appender-ref ref="ASYNC" />
</category>
<category name="jclouds.headers">
<priority value="DEBUG" />
<appender-ref ref="ASYNCWIRE" />
</category>
<category name="jclouds.ssh">
<priority value="DEBUG" />
<appender-ref ref="ASYNCSSH" />
</category>
<category name="jclouds.wire">
<priority value="DEBUG" />
<appender-ref ref="ASYNCWIRE" />
</category>
<category name="jclouds.compute">
<priority value="TRACE" />
<appender-ref ref="ASYNCCOMPUTE" />
</category>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<priority value="WARN" />
</root>
</log4j:configuration>

View File

@ -39,5 +39,6 @@
<module>elb</module> <module>elb</module>
<module>aws-elb</module> <module>aws-elb</module>
<module>savvis-symphonyvpdc</module> <module>savvis-symphonyvpdc</module>
<module>dmtf</module>
</modules> </modules>
</project> </project>

View File

@ -57,6 +57,11 @@
<artifactId>jclouds-compute</artifactId> <artifactId>jclouds-compute</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jclouds.labs</groupId>
<artifactId>dmtf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId> <artifactId>jclouds-core</artifactId>

View File

@ -20,7 +20,6 @@ package org.jclouds.vcloud.director.v1_5;
import java.net.URI; import java.net.URI;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.apis.ApiType; import org.jclouds.apis.ApiType;
import org.jclouds.apis.BaseApiMetadata; import org.jclouds.apis.BaseApiMetadata;

View File

@ -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_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. */ /** 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"; public static final String PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud-director.timeout.task-complete";

View File

@ -19,12 +19,6 @@
package org.jclouds.vcloud.director.v1_5.admin; package org.jclouds.vcloud.director.v1_5.admin;
import org.jclouds.rest.annotations.Delegate; 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.AdminCatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient;

View File

@ -22,12 +22,6 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate; 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.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; 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.AdminVdcClient;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; 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.features.admin.UserClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient; 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 * @return synchronous access to {@link AdminVdc} features
*/ */
@Override
@Delegate @Delegate
AdminVdcClient getVdcClient(); AdminVdcClient getVdcClient();

View File

@ -28,8 +28,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants; import org.jclouds.dmtf.DMTFConstants;
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;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
@ -100,9 +100,8 @@ public abstract class AbstractVAppType extends ResourceEntityType {
/** /**
* @see AbstractVAppType#getSections() * @see AbstractVAppType#getSections()
*/ */
public B sections(List<SectionType> sections) { public B sections(Iterable<? extends SectionType> sections) {
if (checkNotNull(sections, "sections").size() > 0) this.sections = Lists.newArrayList(checkNotNull(sections, "sections"));
this.sections = Lists.newArrayList(sections);
return self(); return self();
} }
@ -123,8 +122,8 @@ public abstract class AbstractVAppType extends ResourceEntityType {
@XmlElement(name = "VAppParent") @XmlElement(name = "VAppParent")
private Reference vAppParent; private Reference vAppParent;
@XmlElementRef(name = "Section", namespace = VCloudDirectorConstants.VCLOUD_OVF_NS) @XmlElementRef(namespace = DMTFConstants.OVF_NS)
private List<SectionType> sections = Lists.newArrayList(); private List<? extends SectionType> sections = Lists.newArrayList();
@XmlAttribute @XmlAttribute
private Boolean deployed; private Boolean deployed;
@ -171,7 +170,7 @@ public abstract class AbstractVAppType extends ResourceEntityType {
* <li>InstallSectionType * <li>InstallSectionType
* </ul> * </ul>
*/ */
public List<SectionType> getSections() { public List<? extends SectionType> getSections() {
return this.sections; return this.sections;
} }
@ -189,8 +188,10 @@ public abstract class AbstractVAppType extends ResourceEntityType {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
AbstractVAppType that = AbstractVAppType.class.cast(o); AbstractVAppType that = AbstractVAppType.class.cast(o);
return super.equals(that) && return super.equals(that)
equal(this.vAppParent, that.vAppParent) && equal(this.sections, that.sections) && equal(this.deployed, that.deployed); && equal(this.vAppParent, that.vAppParent)
&& equal(this.sections, that.sections)
&& equal(this.deployed, that.deployed);
} }
@Override @Override
@ -200,6 +201,9 @@ public abstract class AbstractVAppType extends ResourceEntityType {
@Override @Override
public ToStringHelper string() { 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);
} }
} }

View File

@ -131,6 +131,7 @@ public class AdminVdc extends Vdc {
return self(); return self();
} }
@Override
public AdminVdc build() { public AdminVdc build() {
return new AdminVdc(this); return new AdminVdc(this);
} }

View File

@ -61,6 +61,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromCapacityWithUsage(this); return new Builder().fromCapacityWithUsage(this);
} }
@ -87,6 +88,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
} }
@Override
public CapacityWithUsage build() { public CapacityWithUsage build() {
return new CapacityWithUsage(units, allocated, limit, used, overhead); return new CapacityWithUsage(units, allocated, limit, used, overhead);
} }
@ -94,6 +96,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/** /**
* @see CapacityType#getUnits() * @see CapacityType#getUnits()
*/ */
@Override
public Builder units(String units) { public Builder units(String units) {
this.units = units; this.units = units;
return this; return this;
@ -102,6 +105,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/** /**
* @see CapacityType#getAllocated() * @see CapacityType#getAllocated()
*/ */
@Override
public Builder allocated(Long allocated) { public Builder allocated(Long allocated) {
this.allocated = allocated; this.allocated = allocated;
return this; return this;
@ -110,6 +114,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/** /**
* @see CapacityType#getLimit() * @see CapacityType#getLimit()
*/ */
@Override
public Builder limit(Long limit) { public Builder limit(Long limit) {
this.limit = limit; this.limit = limit;
return this; return this;

View File

@ -31,8 +31,7 @@ import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -111,6 +110,7 @@ public class CaptureVAppParams extends ParamsType {
return self(); return self();
} }
@Override
public CaptureVAppParams build() { public CaptureVAppParams build() {
return new CaptureVAppParams(this); return new CaptureVAppParams(this);
} }

View File

@ -42,6 +42,7 @@ public class Catalog extends CatalogType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromCatalog(this); return builder().fromCatalog(this);
} }

View File

@ -49,6 +49,7 @@ public class CatalogItem extends EntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromCatalogItem(this); return builder().fromCatalogItem(this);
} }

View File

@ -61,6 +61,7 @@ public class CloneMediaParams extends ParamsType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromCloneMediaParams(this); return builder().fromCloneMediaParams(this);
} }
@ -89,6 +90,7 @@ public class CloneMediaParams extends ParamsType {
return self(); return self();
} }
@Override
public CloneMediaParams build() { public CloneMediaParams build() {
return new CloneMediaParams(this); return new CloneMediaParams(this);
} }

View File

@ -44,12 +44,13 @@ import com.google.common.collect.Lists;
*/ */
@XmlRootElement(name = "ComposeVAppParams") @XmlRootElement(name = "ComposeVAppParams")
@XmlType(name = "ComposeVAppParamsType") @XmlType(name = "ComposeVAppParamsType")
public class ComposeVAppParams extends VAppCreationParamsType { public class ComposeVAppParams extends VAppCreationParams {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromComposeVAppParams(this); return builder().fromComposeVAppParams(this);
} }
@ -57,7 +58,7 @@ public class ComposeVAppParams extends VAppCreationParamsType {
private static class ConcreteBuilder extends Builder<ConcreteBuilder> { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
} }
public static abstract class Builder<B extends Builder<B>> extends VAppCreationParamsType.Builder<B> { public static abstract class Builder<B extends Builder<B>> extends VAppCreationParams.Builder<B> {
private List<SourcedCompositionItemParam> sourcedItems = Lists.newArrayList(); private List<SourcedCompositionItemParam> sourcedItems = Lists.newArrayList();
private Boolean allEULAsAccepted; private Boolean allEULAsAccepted;

View File

@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; 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.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -88,6 +88,7 @@ public class DhcpService extends NetworkServiceType<DhcpService> {
return this; return this;
} }
@Override
public DhcpService build() { public DhcpService build() {
return new DhcpService(isEnabled, defaultLeaseTime, maxLeaseTime, ipRange); return new DhcpService(isEnabled, defaultLeaseTime, maxLeaseTime, ipRange);
} }

View File

@ -33,6 +33,7 @@ public class Entity extends EntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromEntity(this); return builder().fromEntity(this);
} }

View File

@ -1,4 +1,4 @@
/** /*
* Licensed to jclouds, Inc. (jclouds) under one or more * Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file * contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -16,52 +16,49 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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 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 grkvlt@apache.org
* @author Adam Lowe
*/ */
@XmlRootElement(name = "VirtualSystem", namespace = VCLOUD_OVF_NS) @XmlRootElement(name = "Envelope", namespace = OVF_NS)
public class VirtualSystem extends BaseVirtualSystem { public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
@SuppressWarnings("rawtypes")
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromVirtualSystem(this); return builder().fromEnvelope(this);
} }
private static class ConcreteBuilder extends Builder<ConcreteBuilder> { public static class Builder<B extends Builder<B>> extends BaseEnvelope.Builder<B, VirtualSystem, Envelope> {
}
public static class Builder<B extends Builder<B>> extends BaseVirtualSystem.Builder<B> {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public VirtualSystem build() { public Envelope build() {
return new VirtualSystem(this); return new Envelope(this);
}
public B fromVirtualSystem(VirtualSystem in) {
return fromBaseVirtualSystem(in);
} }
} }
private VirtualSystem(Builder<?> builder) { protected Envelope(Builder<?> builder) {
super(builder); super(builder);
} }
private VirtualSystem() { protected Envelope() {
// for JAXB // For JaxB
} }
} }

View File

@ -59,6 +59,7 @@ public class File extends EntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromFile(this); return builder().fromFile(this);
} }
@ -96,12 +97,13 @@ public class File extends EntityType {
return self(); return self();
} }
@Override
public File build() { public File build() {
return new File(this); return new File(this);
} }
public Builder fromFile(File in) { public B fromFile(File in) {
return fromEntityType(in) return fromEntityType(in)
.size(in.getSize()) .size(in.getSize())
.bytesTransferred(in.getBytesTransferred()) .bytesTransferred(in.getBytesTransferred())

View File

@ -69,6 +69,7 @@ public class FirewallService extends NetworkServiceType<FirewallService> {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromFirewallService(this); return new Builder().fromFirewallService(this);
} }
@ -102,6 +103,7 @@ public class FirewallService extends NetworkServiceType<FirewallService> {
return this; return this;
} }
@Override
public FirewallService build() { public FirewallService build() {
return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules); return new FirewallService(isEnabled, defaultAction, logDefaultAction, firewallRules);

View File

@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -37,12 +37,13 @@ import com.google.common.base.Objects.ToStringHelper;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlType(name = "InstantiateOvfParams") @XmlType(name = "InstantiateOvfParams")
public class InstantiateOvfParams extends VAppCreationParamsType { public class InstantiateOvfParams extends VAppCreationParams {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromInstantiateOvfParams(this); return builder().fromInstantiateOvfParams(this);
} }
@ -50,7 +51,7 @@ public class InstantiateOvfParams extends VAppCreationParamsType {
private static class ConcreteBuilder extends Builder<ConcreteBuilder> { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
} }
public static abstract class Builder<B extends Builder<B>> extends VAppCreationParamsType.Builder<B> { public static abstract class Builder<B extends Builder<B>> extends VAppCreationParams.Builder<B> {
private Boolean allEULAsAccepted; private Boolean allEULAsAccepted;
private String transferFormat; private String transferFormat;

View File

@ -42,7 +42,7 @@ import com.google.common.base.Objects.ToStringHelper;
*/ */
@XmlRootElement(name = "InstantiateVAppParams") @XmlRootElement(name = "InstantiateVAppParams")
@XmlType(name = "InstantiateVAppParamsType") @XmlType(name = "InstantiateVAppParamsType")
public class InstantiateVAppParams extends VAppCreationParamsType { public class InstantiateVAppParams extends VAppCreationParams {
public static final String MEDIA_TYPe = VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS; 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<ConcreteBuilder> { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
} }
public static abstract class Builder<B extends Builder<B>> extends VAppCreationParamsType.Builder<B> { public static abstract class Builder<B extends Builder<B>> extends VAppCreationParams.Builder<B> {
private Reference source; private Reference source;
private Boolean sourceDelete; private Boolean sourceDelete;

View File

@ -40,6 +40,7 @@ public class InstantiateVAppTemplateParams extends InstantiateVAppParams {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromInstantiateVAppTemplateParams(this); return builder().fromInstantiateVAppTemplateParams(this);
} }

View File

@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -39,7 +39,7 @@ public abstract class IpsecVpnManagedPeerType<T extends IpsecVpnManagedPeerType<
/** /**
* @see IpRange#getStartAddress() * @see IpRange#getStartAddress()
*/ */
public Builder id(String id) { public Builder<T> id(String id) {
this.id = id; this.id = id;
return this; return this;
} }
@ -47,13 +47,14 @@ public abstract class IpsecVpnManagedPeerType<T extends IpsecVpnManagedPeerType<
/** /**
* @see IpRange#getEndAddress() * @see IpRange#getEndAddress()
*/ */
public Builder name(String name) { public Builder<T> name(String name) {
this.name = name; this.name = name;
return this; return this;
} }
public Builder<T> fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<T> in) { public Builder<T> fromIpsecVpnManagedPeerType(IpsecVpnManagedPeerType<T> in) {
return id(in.getId()).name(in.getName()); return id(in.getId())
.name(in.getName());
} }
} }

View File

@ -58,7 +58,7 @@ import com.google.common.base.Objects;
"vcdUsername" "vcdUsername"
}) })
public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType<IpsecVpnRemotePeer> { public class IpsecVpnRemotePeer extends IpsecVpnManagedPeerType<IpsecVpnRemotePeer> {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }

View File

@ -69,6 +69,7 @@ public class IpsecVpnService extends NetworkServiceType<IpsecVpnService> {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromIpsecVpnService(this); return new Builder().fromIpsecVpnService(this);
} }
@ -103,6 +104,7 @@ public class IpsecVpnService extends NetworkServiceType<IpsecVpnService> {
return this; return this;
} }
@Override
public IpsecVpnService build() { public IpsecVpnService build() {
return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels); return new IpsecVpnService(isEnabled, externalIpAddress, publicIpAddress, ipsecVpnTunnels);
} }

View File

@ -33,7 +33,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -153,6 +153,7 @@ public class Link extends Reference {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromLink(this); return builder().fromLink(this);
} }

View File

@ -85,6 +85,7 @@ public class Media extends ResourceEntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromMedia(this); return builder().fromMedia(this);
} }

View File

@ -52,6 +52,7 @@ public class Metadata extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromMetadata(this); return builder().fromMetadata(this);
} }

View File

@ -51,6 +51,7 @@ public class MetadataEntry extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromMetadataEntry(this); return builder().fromMetadataEntry(this);
} }

View File

@ -51,6 +51,7 @@ public class MetadataValue extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromMetadataValue(this); return builder().fromMetadataValue(this);
} }

View File

@ -62,7 +62,7 @@ import com.google.common.base.Objects;
"vmRule" "vmRule"
}) })
public class NatRule { public class NatRule {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }

View File

@ -102,6 +102,7 @@ public class NatService extends NetworkServiceType<NatService> {
return this; return this;
} }
@Override
public NatService build() { public NatService build() {
return new NatService(isEnabled, natType, policy, natRules); return new NatService(isEnabled, natType, policy, natRules);
} }

View File

@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; 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.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -16,12 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; 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_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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_VMW_NS;
import java.net.URI; import java.net.URI;
@ -30,11 +29,10 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlSeeAlso;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -43,15 +41,17 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
* @author grkvlt@apache.org
*/ */
@XmlRootElement(name = "OperatingSystemSection") @XmlRootElement(name = "OperatingSystemSection")
@XmlType @XmlSeeAlso({ org.jclouds.dmtf.ovf.OperatingSystemSection.class })
public class OperatingSystemSection extends SectionType { public class OperatingSystemSection extends org.jclouds.dmtf.ovf.OperatingSystemSection {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromOperatingSystemSection(this); return builder().fromOperatingSystemSection(this);
} }
@ -59,39 +59,13 @@ public class OperatingSystemSection extends SectionType {
private static class ConcreteBuilder extends Builder<ConcreteBuilder> { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
} }
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> { public static class Builder<B extends Builder<B>> extends org.jclouds.dmtf.ovf.OperatingSystemSection.Builder<B> {
private int id;
private String description;
private String version;
private String osType; private String osType;
private URI href; private URI href;
private String type; private String type;
private Set<Link> links; private Set<Link> 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() * @see OperatingSystemSection#getOsType()
*/ */
@ -125,11 +99,9 @@ public class OperatingSystemSection extends SectionType {
} }
/** /**
* @see ResourceType#getLinks() * @see OperatingSystemSection#getLinks()
*/ */
public B link(Link link) { public B link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link")); this.links.add(checkNotNull(link, "link"));
return self(); return self();
} }
@ -143,18 +115,14 @@ public class OperatingSystemSection extends SectionType {
} }
public B fromOperatingSystemSection(OperatingSystemSection in) { public B fromOperatingSystemSection(OperatingSystemSection in) {
return fromSectionType(in) return super.fromOperatingSystemSection(in)
.id(in.getId()).version(in.getVersion()).description(in.getDescription()) .osType(in.getOsType())
.osType(in.getOsType()).href(in.getHref()).type(in.getType()).links(in.getLinks()); .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) @XmlAttribute(namespace = VCLOUD_VMW_NS)
protected String osType; protected String osType;
@XmlAttribute(namespace = VCLOUD_1_5_NS) @XmlAttribute(namespace = VCLOUD_1_5_NS)
@ -162,46 +130,20 @@ public class OperatingSystemSection extends SectionType {
@XmlAttribute(namespace = VCLOUD_1_5_NS) @XmlAttribute(namespace = VCLOUD_1_5_NS)
private String type; private String type;
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS) @XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
private Set<Link> links; private Set<Link> links = Sets.newLinkedHashSet();
public OperatingSystemSection(Builder<?> builder) { public OperatingSystemSection(Builder<?> builder) {
super(builder); super(builder);
this.id = builder.id;
this.description = builder.description;
this.version = builder.version;
this.osType = builder.osType; this.osType = builder.osType;
this.href = builder.href; this.href = builder.href;
this.type = builder.type; this.type = builder.type;
this.links = builder.links; this.links = builder.links != null && builder.links.isEmpty() ? null : builder.links;;
} }
protected OperatingSystemSection() { protected OperatingSystemSection() {
// For Builders and JAXB // 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 * Gets the osType
*/ */
@ -233,12 +175,12 @@ public class OperatingSystemSection extends SectionType {
* @see ResourceType#getLinks() * @see ResourceType#getLinks()
*/ */
public Set<Link> getLinks() { public Set<Link> getLinks() {
return links == null ? Sets.<Link>newLinkedHashSet() : ImmutableSet.copyOf(links); return links != null ? ImmutableSet.copyOf(links) : Sets.<Link>newLinkedHashSet();
} }
@Override @Override
public int hashCode() { 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 @Override
@ -246,16 +188,21 @@ public class OperatingSystemSection extends SectionType {
if (this == obj) return true; if (this == obj) return true;
if (obj == null) return false; if (obj == null) return false;
if (getClass() != obj.getClass()) return false; if (getClass() != obj.getClass()) return false;
OperatingSystemSection that = (OperatingSystemSection) obj; OperatingSystemSection that = (OperatingSystemSection) obj;
return super.equals(that) && 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.osType, that.osType) && equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type); && equal(this.href, that.href)
&& equal(this.links, that.links)
&& equal(this.type, that.type);
} }
@Override @Override
protected Objects.ToStringHelper string() { public ToStringHelper string() {
return super.string().add("id", id).add("version", version).add("description", description).add("osType", osType) return super.string()
.add("href", href).add("links", links).add("type", type); .add("osType", osType)
.add("type", type)
.add("href", href)
.add("links", links);
} }
} }

View File

@ -50,6 +50,7 @@ public class Org extends EntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromOrg(this); return builder().fromOrg(this);
} }

View File

@ -61,6 +61,7 @@ public class OrgGeneralSettings extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromOrgGeneralSettings(this); return builder().fromOrgGeneralSettings(this);
} }
@ -116,6 +117,7 @@ public class OrgGeneralSettings extends ResourceType {
return self(); return self();
} }
@Override
public OrgGeneralSettings build() { public OrgGeneralSettings build() {
return new OrgGeneralSettings(this); return new OrgGeneralSettings(this);
} }

View File

@ -64,6 +64,7 @@ public class OrgSettings extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromOrgSettings(this); return builder().fromOrgSettings(this);
} }
@ -128,6 +129,7 @@ public class OrgSettings extends ResourceType {
return self(); return self();
} }
@Override
public OrgSettings build() { public OrgSettings build() {
return new OrgSettings(this); return new OrgSettings(this);
} }

View File

@ -44,6 +44,7 @@ public class Owner extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromOwner(this); return builder().fromOwner(this);
} }

View File

@ -30,8 +30,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants; import org.jclouds.dmtf.DMTFConstants;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection; import org.jclouds.dmtf.ovf.ProductSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
@ -78,8 +78,7 @@ public class ProductSectionList extends ResourceType implements Set<ProductSecti
* @see ProductSectionList#getProductSections() * @see ProductSectionList#getProductSections()
*/ */
public B productSections(Set<ProductSection> productSections) { public B productSections(Set<ProductSection> productSections) {
if (checkNotNull(productSections, "productSections").size() > 0) this.productSections = Sets.newLinkedHashSet(checkNotNull(productSections, "productSections"));
this.productSections = Sets.newLinkedHashSet(productSections);
return self(); return self();
} }
@ -87,8 +86,6 @@ public class ProductSectionList extends ResourceType implements Set<ProductSecti
* @see ProductSectionList#getProductSections() * @see ProductSectionList#getProductSections()
*/ */
public B productSection(ProductSection productSection) { public B productSection(ProductSection productSection) {
if (productSections == null)
productSections = Sets.newLinkedHashSet();
this.productSections.add(checkNotNull(productSection, "productSection")); this.productSections.add(checkNotNull(productSection, "productSection"));
return self(); return self();
} }
@ -114,7 +111,7 @@ public class ProductSectionList extends ResourceType implements Set<ProductSecti
} }
@XmlElement(name = "ProductSection", namespace = VCloudDirectorConstants.VCLOUD_OVF_NS) @XmlElement(name = "ProductSection", namespace = DMTFConstants.OVF_NS)
private Set<ProductSection> productSections; private Set<ProductSection> productSections;
/** /**
@ -131,7 +128,8 @@ public class ProductSectionList extends ResourceType implements Set<ProductSecti
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
ProductSectionList that = ProductSectionList.class.cast(o); ProductSectionList that = ProductSectionList.class.cast(o);
return super.equals(that) && equal(this.productSections, that.productSections); return super.equals(that)
&& equal(this.productSections, that.productSections);
} }
@Override @Override

View File

@ -0,0 +1,191 @@
/*
* 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 org.jclouds.dmtf.cim.ResourceAllocationSettingData;
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 ResourceAllocationSettingData class represents settings specifically
* related to an allocated resource that are outside the scope of the CIM class
* typically used to represent the resource itself.
*
* @author grkvlt@apache.org
*/
@XmlRootElement(name = "Item", namespace = VCLOUD_1_5_NS)
public class RasdItem extends ResourceAllocationSettingData {
public static Builder<?> builder() {
return new ConcreteBuilder();
}
@Override
public Builder<?> toBuilder() {
return builder().fromRasdItem(this);
}
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
}
public static class Builder<B extends Builder<B>> extends ResourceAllocationSettingData.Builder<Builder<B>>{
private URI href;
private String type;
private Set<Link> 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<Link> 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<Link> 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<Link> getLinks() {
return links != null ? ImmutableSet.copyOf(links) : Sets.<Link>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);
}
}

View File

@ -29,8 +29,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -46,7 +44,7 @@ import com.google.common.collect.Sets;
*/ */
@XmlRootElement(name = "RasdItemsList") @XmlRootElement(name = "RasdItemsList")
@XmlType(name = "RasdItemsList") @XmlType(name = "RasdItemsList")
public class RasdItemsList extends ResourceType implements Set<ResourceAllocationSettingData> { public class RasdItemsList extends ResourceType implements Set<RasdItem> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
@ -62,12 +60,12 @@ public class RasdItemsList extends ResourceType implements Set<ResourceAllocatio
public static abstract class Builder<B extends Builder<B>> extends ResourceType.Builder<B> { public static abstract class Builder<B extends Builder<B>> extends ResourceType.Builder<B> {
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet(); private Set<RasdItem> items = Sets.newLinkedHashSet();
/** /**
* @see RasdItemsList#getItems() * @see RasdItemsList#getItems()
*/ */
public B items(Set<ResourceAllocationSettingData> items) { public B items(Set<RasdItem> items) {
this.items = checkNotNull(items, "items"); this.items = checkNotNull(items, "items");
return self(); return self();
} }
@ -75,7 +73,7 @@ public class RasdItemsList extends ResourceType implements Set<ResourceAllocatio
/** /**
* @see RasdItemsList#getItems() * @see RasdItemsList#getItems()
*/ */
public B item(ResourceAllocationSettingData item) { public B item(RasdItem item) {
this.items.add(checkNotNull(item, "item")); this.items.add(checkNotNull(item, "item"));
return self(); return self();
} }
@ -101,12 +99,12 @@ public class RasdItemsList extends ResourceType implements Set<ResourceAllocatio
} }
@XmlElement(name = "Item") @XmlElement(name = "Item")
protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet(); protected Set<RasdItem> items = Sets.newLinkedHashSet();
/** /**
* A RASD item content. * A RASD item content.
*/ */
public Set<ResourceAllocationSettingData> getItems() { public Set<RasdItem> getItems() {
return items; return items;
} }
@ -137,17 +135,17 @@ public class RasdItemsList extends ResourceType implements Set<ResourceAllocatio
* <p> * <p>
* NOTE Annoying lack of multiple inheritance for using ForwardingList! * NOTE Annoying lack of multiple inheritance for using ForwardingList!
*/ */
private Set<ResourceAllocationSettingData> delegate() { private Set<RasdItem> delegate() {
return getItems(); return getItems();
} }
@Override @Override
public boolean add(ResourceAllocationSettingData arg0) { public boolean add(RasdItem arg0) {
return delegate().add(arg0); return delegate().add(arg0);
} }
@Override @Override
public boolean addAll(Collection<? extends ResourceAllocationSettingData> arg0) { public boolean addAll(Collection<? extends RasdItem> arg0) {
return delegate().addAll(arg0); return delegate().addAll(arg0);
} }
@ -172,7 +170,7 @@ public class RasdItemsList extends ResourceType implements Set<ResourceAllocatio
} }
@Override @Override
public Iterator<ResourceAllocationSettingData> iterator() { public Iterator<RasdItem> iterator() {
return delegate().iterator(); return delegate().iterator();
} }

View File

@ -55,6 +55,7 @@ public class RecomposeVAppParams extends ComposeVAppParams {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromRecomposeVAppParams(this); return builder().fromRecomposeVAppParams(this);
} }

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Objects.equal;
import java.util.Set; import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;

View File

@ -32,6 +32,7 @@ public class Resource extends ResourceType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromResource(this); return builder().fromResource(this);
} }

View File

@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; 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;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;

View File

@ -65,6 +65,7 @@ public class StaticRoutingService extends NetworkServiceType<StaticRoutingServic
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromStaticRoutingService(this); return new Builder().fromStaticRoutingService(this);
} }
@ -82,6 +83,7 @@ public class StaticRoutingService extends NetworkServiceType<StaticRoutingServic
} }
@Override
public StaticRoutingService build() { public StaticRoutingService build() {
return new StaticRoutingService(isEnabled, staticRoutes); return new StaticRoutingService(isEnabled, staticRoutes);
} }

View File

@ -100,6 +100,7 @@ public class Task extends EntityType {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromTask(this); return builder().fromTask(this);
} }

View File

@ -47,6 +47,7 @@ public class TasksList extends ResourceType implements Set<Task> {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@Override
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return builder().fromTasksList(this); return builder().fromTasksList(this);
} }

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