Issue 830: Fixes for various failing tests, updates for CIM and RASD domain objects

This commit is contained in:
Andrew Donald Kennedy 2012-03-17 15:00:02 +00:00
parent 45fd7c443e
commit 6846dad9fc
22 changed files with 1125 additions and 1084 deletions

View File

@ -36,6 +36,10 @@ public class VCloudDirectorConstants {
public static final String VCLOUD_CIM_NS = "http://schemas.dmtf.org/wbem/wscim/1/common"; 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

@ -79,7 +79,15 @@ public class NetworkConnectionSection extends SectionType {
* @see NetworkConnectionSection#getNetworkConnections() * @see NetworkConnectionSection#getNetworkConnections()
*/ */
public B networkConnections(Set<NetworkConnection> networkConnections) { public B networkConnections(Set<NetworkConnection> networkConnections) {
this.networkConnections = checkNotNull(networkConnections, "networkConnection"); this.networkConnections = checkNotNull(networkConnections, "networkConnections");
return self();
}
/**
* @see NetworkConnectionSection#getNetworkConnections()
*/
public B networkConnection(NetworkConnection networkConnection) {
this.networkConnections.add(checkNotNull(networkConnection, "networkConnection"));
return self(); return self();
} }
@ -110,12 +118,15 @@ public class NetworkConnectionSection extends SectionType {
@Override @Override
public NetworkConnectionSection build() { public NetworkConnectionSection build() {
return new NetworkConnectionSection(this); return new NetworkConnectionSection(this);
} }
public B fromNetworkConnectionSection(NetworkConnectionSection in) { public B fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSectionType(in).primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).networkConnections(in.getNetworkConnections()).links(in.getLinks()).href(in.getHref()).type( return fromSectionType(in)
in.getType()); .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnections(Sets.newLinkedHashSet(in.getNetworkConnections()))
.links(Sets.newLinkedHashSet(in.getLinks()))
.href(in.getHref())
.type(in.getType());
} }
} }

View File

@ -116,7 +116,7 @@ public class ResourceType {
} }
protected B fromResourceType(ResourceType in) { protected B fromResourceType(ResourceType in) {
return href(in.getHref()).type(in.getType()).links(in.getLinks()); return href(in.getHref()).type(in.getType()).links(Sets.newLinkedHashSet(in.getLinks()));
} }
} }

View File

@ -1,128 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain.cim;
/**
*
* ManagedElement is an abstract class that provides a common superclass (or top of the inheritance
* tree) for the non-association classes in the CIM Schema.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public abstract class ManagedElement extends SettingData {
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromManagedElement(this);
}
public static class Builder extends SettingData.Builder {
protected String caption;
protected String description;
/**
* @see ManagedElement#getCaption
*/
public Builder caption(String caption) {
this.caption = caption;
return this;
}
/**
* @see ManagedElement#getDescription
*/
public Builder description(String description) {
this.description = description;
return this;
}
public Builder fromManagedElement(ManagedElement in) {
return caption(in.getCaption()).description(in.getDescription()).fromSettingData(in);
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSettingData(SettingData in) {
return Builder.class.cast(super.fromSettingData(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
}
}
protected String caption;
protected String description;
protected ManagedElement(String elementName, String instanceID, String caption, String description) {
super(elementName, instanceID);
this.caption = caption;
this.description = description;
}
protected ManagedElement() {
// for JAXB
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public String getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public String getDescription() {
return description;
}
@Override
public String toString() {
return String.format("[elementName=%s, instanceID=%s, caption=%s, description=%s]", elementName, instanceID,
caption, description);
}
}

View File

@ -29,179 +29,138 @@ import org.jclouds.compute.domain.OsFamily;
* /> * />
*/ */
public enum OSType { public enum OSType {
/**
* Other /** Other */
*/
OTHER(1, "Other", OsFamily.UNRECOGNIZED, false), OTHER(1, "Other", OsFamily.UNRECOGNIZED, false),
/**
* MACOS /** MACOS */
*/
MACOS(2, "MACOS", OsFamily.DARWIN, false), MACOS(2, "MACOS", OsFamily.DARWIN, false),
/**
* Solaris /** Solaris */
*/
SOLARIS(29, "Solaris", OsFamily.SOLARIS, false), SOLARIS(29, "Solaris", OsFamily.SOLARIS, false),
/**
* LINUX /** LINUX */
*/
LINUX(36, "LINUX", OsFamily.LINUX, false), LINUX(36, "LINUX", OsFamily.LINUX, false),
/**
* FreeBSD /** FreeBSD */
*/
FREEBSD(42, "FreeBSD", OsFamily.FREEBSD, false), FREEBSD(42, "FreeBSD", OsFamily.FREEBSD, false),
/**
* NetBSD /** NetBSD */
*/
NETBSD(43, "NetBSD", OsFamily.NETBSD, false), NETBSD(43, "NetBSD", OsFamily.NETBSD, false),
/**
* OpenBSD /** OpenBSD */
*/
OPENBSD(65, "OpenBSD", OsFamily.OPENBSD, false), OPENBSD(65, "OpenBSD", OsFamily.OPENBSD, false),
/**
* Not Applicable /** Not Applicable */
*/
NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false), NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false),
/**
* Microsoft Windows Server 2003 /** Microsoft Windows Server 2003 */
*/
WINDOWS_SERVER_2003(69, "Microsoft Windows Server 2003", OsFamily.WINDOWS, false), WINDOWS_SERVER_2003(69, "Microsoft Windows Server 2003", OsFamily.WINDOWS, false),
/**
* Microsoft Windows Server 2003 64-Bit /** Microsoft Windows Server 2003 64-Bit */
*/
WINDOWS_SERVER_2003_64(70, "Microsoft Windows Server 2003 64-Bit", OsFamily.WINDOWS, true), WINDOWS_SERVER_2003_64(70, "Microsoft Windows Server 2003 64-Bit", OsFamily.WINDOWS, true),
/**
* Microsoft Windows Server 2008 /** Microsoft Windows Server 2008 */
*/
WINDOWS_SERVER_2008(76, "Microsoft Windows Server 2008", OsFamily.WINDOWS, false), WINDOWS_SERVER_2008(76, "Microsoft Windows Server 2008", OsFamily.WINDOWS, false),
/**
* Microsoft Windows Server 2008 64-Bit /** Microsoft Windows Server 2008 64-Bit */
*/
WINDOWS_SERVER_2008_64(77, "Microsoft Windows Server 2008 64-Bit", OsFamily.WINDOWS, true), WINDOWS_SERVER_2008_64(77, "Microsoft Windows Server 2008 64-Bit", OsFamily.WINDOWS, true),
/**
* FreeBSD 64-Bit /** FreeBSD 64-Bit */
*/
FREEBSD_64(78, "FreeBSD 64-Bit", OsFamily.FREEBSD, true), FREEBSD_64(78, "FreeBSD 64-Bit", OsFamily.FREEBSD, true),
/**
* RedHat Enterprise Linux /** RedHat Enterprise Linux */
*/
RHEL(79, "RedHat Enterprise Linux", OsFamily.RHEL, false), RHEL(79, "RedHat Enterprise Linux", OsFamily.RHEL, false),
/**
* RedHat Enterprise Linux 64-Bit /** RedHat Enterprise Linux 64-Bit */
*/
RHEL_64(80, "RedHat Enterprise Linux 64-Bit", OsFamily.RHEL, true), RHEL_64(80, "RedHat Enterprise Linux 64-Bit", OsFamily.RHEL, true),
/**
* Solaris 64-Bit /** Solaris 64-Bit */
*/
SOLARIS_64(81, "Solaris 64-Bit", OsFamily.SOLARIS, true), SOLARIS_64(81, "Solaris 64-Bit", OsFamily.SOLARIS, true),
/**
* SUSE /** SUSE */
*/
SUSE(82, "SUSE", OsFamily.SUSE, false), SUSE(82, "SUSE", OsFamily.SUSE, false),
/**
* SUSE 64-Bit /** SUSE 64-Bit */
*/
SUSE_64(83, "SUSE 64-Bit", OsFamily.SUSE, true), SUSE_64(83, "SUSE 64-Bit", OsFamily.SUSE, true),
/**
* SLES /** SLES */
*/
SLES(84, "SLES", OsFamily.SUSE, false), SLES(84, "SLES", OsFamily.SUSE, false),
/**
* SLES 64-Bit /** SLES 64-Bit */
*/
SLES_64(85, "SLES 64-Bit", OsFamily.SUSE, true), SLES_64(85, "SLES 64-Bit", OsFamily.SUSE, true),
/**
* Novell OES /** Novell OES */
*/
NOVELL_OES(86, "Novell OES", OsFamily.SUSE, true), NOVELL_OES(86, "Novell OES", OsFamily.SUSE, true),
/**
* Mandriva /** Mandriva */
*/
MANDRIVA(89, "Mandriva", OsFamily.MANDRIVA, false), MANDRIVA(89, "Mandriva", OsFamily.MANDRIVA, false),
/**
* Mandriva 64-Bit /** Mandriva 64-Bit */
*/
MANDRIVA_64(90, "Mandriva 64-Bit", OsFamily.MANDRIVA, true), MANDRIVA_64(90, "Mandriva 64-Bit", OsFamily.MANDRIVA, true),
/**
* TurboLinux /** TurboLinux */
*/
TURBOLINUX(91, "TurboLinux", OsFamily.TURBOLINUX, false), TURBOLINUX(91, "TurboLinux", OsFamily.TURBOLINUX, false),
/**
* TurboLinux 64-Bit /** TurboLinux 64-Bit */
*/
TURBOLINUX_64(92, "TurboLinux 64-Bit", OsFamily.TURBOLINUX, true), TURBOLINUX_64(92, "TurboLinux 64-Bit", OsFamily.TURBOLINUX, true),
/**
* Ubuntu /** Ubuntu */
*/
UBUNTU(93, "Ubuntu", OsFamily.UBUNTU, false), UBUNTU(93, "Ubuntu", OsFamily.UBUNTU, false),
/**
* Ubuntu 64-Bit /** Ubuntu 64-Bit */
*/
UBUNTU_64(94, "Ubuntu 64-Bit", OsFamily.UBUNTU, true), UBUNTU_64(94, "Ubuntu 64-Bit", OsFamily.UBUNTU, true),
/**
* Debian /** Debian */
*/
DEBIAN(95, "Debian", OsFamily.DEBIAN, false), DEBIAN(95, "Debian", OsFamily.DEBIAN, false),
/**
* Debian 64-Bit /** Debian 64-Bit */
*/
DEBIAN_64(96, "Debian 64-Bit", OsFamily.DEBIAN, false), DEBIAN_64(96, "Debian 64-Bit", OsFamily.DEBIAN, false),
/**
* Linux 2.4.x /** Linux 2.4.x */
*/
LINUX_2_4(97, "Linux 2.4.x", OsFamily.LINUX, false), LINUX_2_4(97, "Linux 2.4.x", OsFamily.LINUX, false),
/**
* Linux 2.4.x 64-Bi /** Linux 2.4.x 64-Bi */
*/
LINUX_2_4_64(98, "Linux 2.4.x 64-Bit", OsFamily.LINUX, true), LINUX_2_4_64(98, "Linux 2.4.x 64-Bit", OsFamily.LINUX, true),
/**
* Linux 2.6.x /** Linux 2.6.x */
*/
LINUX_2_6(99, "Linux 2.6.x", OsFamily.LINUX, false), LINUX_2_6(99, "Linux 2.6.x", OsFamily.LINUX, false),
/**
* Linux 2.6.x 64-Bit /** Linux 2.6.x 64-Bit */
*/
LINUX_2_6_64(100, "Linux 2.6.x 64-Bit", OsFamily.LINUX, true), LINUX_2_6_64(100, "Linux 2.6.x 64-Bit", OsFamily.LINUX, true),
/**
* Linux 64-Bit /** Linux 64-Bit */
*/
LINUX_64(101, "Linux 64-Bit", OsFamily.LINUX, true), LINUX_64(101, "Linux 64-Bit", OsFamily.LINUX, true),
/**
* Other 64-Bit /** Other 64-Bit */
*/
OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true), OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true),
/**
* Microsoft Windows Server 2008 R2 /** Microsoft Windows Server 2008 R2 */
*/
WINDOWS_SERVER_2008_R2(103, "Microsoft Windows Server 2008 R2", OsFamily.WINDOWS, true), WINDOWS_SERVER_2008_R2(103, "Microsoft Windows Server 2008 R2", OsFamily.WINDOWS, true),
/**
* VMware ESXi /** VMware ESXi */
*/
ESXI(104, "VMware ESXi", OsFamily.ESX, true), ESXI(104, "VMware ESXi", OsFamily.ESX, true),
/**
* Microsoft Windows 7 /** Microsoft Windows 7 */
*/
WINDOWS_7(105, "Microsoft Windows 7", OsFamily.WINDOWS, false), WINDOWS_7(105, "Microsoft Windows 7", OsFamily.WINDOWS, false),
/**
* CentOS 32-bit /** CentOS 32-bit */
*/
CENTOS(106, "CentOS 32-bit", OsFamily.CENTOS, false), CENTOS(106, "CentOS 32-bit", OsFamily.CENTOS, false),
/**
* CentOS 64-bit /** CentOS 64-bit */
*/
CENTOS_64(107, "CentOS 64-bit", OsFamily.CENTOS, true), CENTOS_64(107, "CentOS 64-bit", OsFamily.CENTOS, true),
/**
* Oracle Enterprise Linux 32-bit /** Oracle Enterprise Linux 32-bit */
*/
ORACLE_ENTERPRISE_LINUX(108, "Oracle Enterprise Linux 32-bit", OsFamily.OEL, false), ORACLE_ENTERPRISE_LINUX(108, "Oracle Enterprise Linux 32-bit", OsFamily.OEL, false),
/**
* Oracle Enterprise Linux 64-bit /** Oracle Enterprise Linux 64-bit */
*/
ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true), ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true),
/**
* eComStation 32-bitx /** eComStation 32-bitx */
*/ ECOMSTATION_32(109, "eComStation 32-bitx", OsFamily.UNRECOGNIZED, false),
ECOMSTATION_32(109, "eComStation 32-bitx", OsFamily.UNRECOGNIZED, false), UNRECOGNIZED(Integer.MAX_VALUE,
"UNRECOGNIZED", null, true); UNRECOGNIZED(Integer.MAX_VALUE, "UNRECOGNIZED", null, true);
private final int code; private final int code;
public int getCode() { public int getCode() {

View File

@ -18,75 +18,124 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.vcloud.director.v1_5.domain.cim;
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_CIM_RASD_NS;
import java.net.URI;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.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.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/** /**
*
* The ResourceAllocationSettingData class represents settings specifically * The ResourceAllocationSettingData class represents settings specifically
* related to an allocated resource that are outside the scope of the CIM class * related to an allocated resource that are outside the scope of the CIM class
* typically used to represent the resource itself. These settings include * typically used to represent the resource itself.
* information specific to the allocation that may not be visible to the *
* consumer of the resource itself. For example, a virtual processor may look * These settings include information specific to the allocation that may not
* like a 2 ghz processor to the consumer (virtual computer system), however the * be visible to the consumer of the resource itself. For example, a virtual
* virtualization system may use time-slicing to schedule the the virtual * processor may look like a 2 GHz processor to the consumer (virtual computer
* processor to only allow it to use 1 ghz. * system), however the virtualization system may use time-slicing to schedule
* the the virtual processor to only allow it to use 1 GHz.
* *
* @author Adrian Cole * @author Adrian Cole
* @see <a href= * @author grkvlt@apache.org
* "http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip" * @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd
* />
*
*/ */
public class ResourceAllocationSettingData extends ManagedElement { @XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = VCLOUD_CIM_RASD_NS)
public class ResourceAllocationSettingData {
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() { public Builder toBuilder() {
return builder().fromResourceAllocationSettingData(this); return builder().fromResourceAllocationSettingData(this);
} }
public static class Builder extends ManagedElement.Builder { public static class Builder {
protected String address; protected CimString elementName;
protected String addressOnParent; protected CimString instanceID;
protected String allocationUnits; protected CimString caption;
protected Boolean automaticAllocation; protected CimString description;
protected Boolean automaticDeallocation; protected CimString address;
protected CimString addressOnParent;
protected CimString allocationUnits;
protected CimBoolean automaticAllocation;
protected CimBoolean automaticDeallocation;
protected ConsumerVisibility consumerVisibility; protected ConsumerVisibility consumerVisibility;
protected Long limit; protected CimUnsignedLong limit;
protected MappingBehavior mappingBehavior; protected MappingBehavior mappingBehavior;
protected String otherResourceType; protected CimString otherResourceType;
protected String parent; protected CimString parent;
protected String poolID; protected CimString poolID;
protected Long reservation; protected CimUnsignedLong reservation;
protected String resourceSubType; protected CimString resourceSubType;
protected ResourceType resourceType; protected ResourceType resourceType;
protected Long virtualQuantity; protected CimUnsignedLong virtualQuantity;
protected String virtualQuantityUnits; protected CimString virtualQuantityUnits;
protected Integer weight; protected CimUnsignedInt weight;
protected List<String> connections = Lists.newArrayList(); protected List<CimString> connections = Lists.newArrayList();
protected List<String> hostResources = Lists.newArrayList(); protected List<CimString> hostResources = Lists.newArrayList();
protected URI href;
protected String type;
private Set<Link> links = Sets.newLinkedHashSet();
/**
* @see ResourceAllocationSettingData#getElementName()
*/
public Builder elementName(CimString elementName) {
this.elementName = elementName;
return this;
}
/**
*@see ResourceAllocationSettingData#getInstanceId()
*/
public Builder instanceID(CimString instanceID) {
this.instanceID = instanceID;
return this;
}
/**
* @see ResourceAllocationSettingData#getCaption()
*/
public Builder caption(CimString caption) {
this.caption = caption;
return this;
}
/**
* @see ResourceAllocationSettingData#getDescription()
*/
public Builder description(CimString description) {
this.description = description;
return this;
}
/** /**
* @see ResourceAllocationSettingData#getAddress * @see ResourceAllocationSettingData#getAddress
*/ */
public Builder address(String address) { public Builder address(CimString address) {
this.address = address; this.address = address;
return this; return this;
} }
@ -94,7 +143,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getAddressOnParent * @see ResourceAllocationSettingData#getAddressOnParent
*/ */
public Builder addressOnParent(String addressOnParent) { public Builder addressOnParent(CimString addressOnParent) {
this.addressOnParent = addressOnParent; this.addressOnParent = addressOnParent;
return this; return this;
} }
@ -102,7 +151,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getAllocationUnits * @see ResourceAllocationSettingData#getAllocationUnits
*/ */
public Builder allocationUnits(String allocationUnits) { public Builder allocationUnits(CimString allocationUnits) {
this.allocationUnits = allocationUnits; this.allocationUnits = allocationUnits;
return this; return this;
} }
@ -110,7 +159,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#isAutomaticAllocation() * @see ResourceAllocationSettingData#isAutomaticAllocation()
*/ */
public Builder automaticAllocation(Boolean automaticAllocation) { public Builder automaticAllocation(CimBoolean automaticAllocation) {
this.automaticAllocation = automaticAllocation; this.automaticAllocation = automaticAllocation;
return this; return this;
} }
@ -118,7 +167,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#isAutomaticDeallocation() * @see ResourceAllocationSettingData#isAutomaticDeallocation()
*/ */
public Builder automaticDeallocation(Boolean automaticDeallocation) { public Builder automaticDeallocation(CimBoolean automaticDeallocation) {
this.automaticDeallocation = automaticDeallocation; this.automaticDeallocation = automaticDeallocation;
return this; return this;
} }
@ -134,7 +183,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getLimit * @see ResourceAllocationSettingData#getLimit
*/ */
public Builder limit(Long limit) { public Builder limit(CimUnsignedLong limit) {
this.limit = limit; this.limit = limit;
return this; return this;
} }
@ -150,7 +199,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getOtherResourceType * @see ResourceAllocationSettingData#getOtherResourceType
*/ */
public Builder otherResourceType(String otherResourceType) { public Builder otherResourceType(CimString otherResourceType) {
this.otherResourceType = otherResourceType; this.otherResourceType = otherResourceType;
return this; return this;
} }
@ -158,7 +207,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getParent * @see ResourceAllocationSettingData#getParent
*/ */
public Builder parent(String parent) { public Builder parent(CimString parent) {
this.parent = parent; this.parent = parent;
return this; return this;
} }
@ -166,7 +215,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getPoolID * @see ResourceAllocationSettingData#getPoolID
*/ */
public Builder poolID(String poolID) { public Builder poolID(CimString poolID) {
this.poolID = poolID; this.poolID = poolID;
return this; return this;
} }
@ -174,7 +223,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getReservation * @see ResourceAllocationSettingData#getReservation
*/ */
public Builder reservation(Long reservation) { public Builder reservation(CimUnsignedLong reservation) {
this.reservation = reservation; this.reservation = reservation;
return this; return this;
} }
@ -182,7 +231,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getResourceSubType * @see ResourceAllocationSettingData#getResourceSubType
*/ */
public Builder resourceSubType(String resourceSubType) { public Builder resourceSubType(CimString resourceSubType) {
this.resourceSubType = resourceSubType; this.resourceSubType = resourceSubType;
return this; return this;
} }
@ -198,7 +247,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getVirtualQuantity * @see ResourceAllocationSettingData#getVirtualQuantity
*/ */
public Builder virtualQuantity(Long virtualQuantity) { public Builder virtualQuantity(CimUnsignedLong virtualQuantity) {
this.virtualQuantity = virtualQuantity; this.virtualQuantity = virtualQuantity;
return this; return this;
} }
@ -206,7 +255,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getVirtualQuantityUnits * @see ResourceAllocationSettingData#getVirtualQuantityUnits
*/ */
public Builder virtualQuantityUnits(String virtualQuantityUnits) { public Builder virtualQuantityUnits(CimString virtualQuantityUnits) {
this.virtualQuantityUnits = virtualQuantityUnits; this.virtualQuantityUnits = virtualQuantityUnits;
return this; return this;
} }
@ -214,7 +263,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getWeight * @see ResourceAllocationSettingData#getWeight
*/ */
public Builder weight(Integer weight) { public Builder weight(CimUnsignedInt weight) {
this.weight = weight; this.weight = weight;
return this; return this;
} }
@ -222,7 +271,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getConnections() * @see ResourceAllocationSettingData#getConnections()
*/ */
public Builder connection(String connection) { public Builder connection(CimString connection) {
this.connections.add(checkNotNull(connection, "connection")); this.connections.add(checkNotNull(connection, "connection"));
return this; return this;
} }
@ -230,7 +279,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getHostResources() * @see ResourceAllocationSettingData#getHostResources()
*/ */
public Builder hostResource(String hostResource) { public Builder hostResource(CimString hostResource) {
this.hostResources.add(checkNotNull(hostResource, "hostResource")); this.hostResources.add(checkNotNull(hostResource, "hostResource"));
return this; return this;
} }
@ -238,7 +287,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getConnections * @see ResourceAllocationSettingData#getConnections
*/ */
public Builder connections(List<String> connections) { public Builder connections(List<CimString> connections) {
this.connections = Lists.newArrayList(checkNotNull(connections, "connections")); this.connections = Lists.newArrayList(checkNotNull(connections, "connections"));
return this; return this;
} }
@ -246,84 +295,123 @@ public class ResourceAllocationSettingData extends ManagedElement {
/** /**
* @see ResourceAllocationSettingData#getHostResources * @see ResourceAllocationSettingData#getHostResources
*/ */
public Builder hostResources(List<String> hostResources) { public Builder hostResources(List<CimString> hostResources) {
this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources")); this.hostResources = Lists.newArrayList(checkNotNull(hostResources, "hostResources"));
return this; return this;
} }
/**
* @see ResourceAllocationSettingData#getType()
*/
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see ResourceAllocationSettingData#getHref()
*/
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* @see ResourceAllocationSettingData#getLinks()
*/
public Builder links(Set<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(elementName, instanceID, caption, description, address,
addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
virtualQuantity, virtualQuantityUnits, weight, connections, hostResources); virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, type, href, links);
} }
public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
return fromManagedElement(in).address(in.getAddress()).addressOnParent(in.getAddressOnParent()) return elementName(in.getElementName())
.allocationUnits(in.getAllocationUnits()).automaticAllocation(in.isAutomaticAllocation()) .instanceID(in.getInstanceID())
.automaticDeallocation(in.isAutomaticDeallocation()).consumerVisibility(in.getConsumerVisibility()) .caption(in.getCaption())
.limit(in.getLimit()).mappingBehavior(in.getMappingBehavior()) .description(in.getDescription())
.otherResourceType(in.getOtherResourceType()).parent(in.getParent()).poolID(in.getPoolID()) .address(in.getAddress())
.reservation(in.getReservation()).resourceSubType(in.getResourceSubType()) .addressOnParent(in.getAddressOnParent())
.resourceType(in.getResourceType()).virtualQuantity(in.getVirtualQuantity()) .allocationUnits(in.getAllocationUnits())
.virtualQuantityUnits(in.getVirtualQuantityUnits()).weight(in.getWeight()) .automaticAllocation(in.isAutomaticAllocation())
.connections(in.getConnections()).hostResources(in.getHostResources()); .automaticDeallocation(in.isAutomaticDeallocation())
.consumerVisibility(in.getConsumerVisibility())
.limit(in.getLimit())
.mappingBehavior(in.getMappingBehavior())
.otherResourceType(in.getOtherResourceType())
.parent(in.getParent())
.poolID(in.getPoolID())
.reservation(in.getReservation())
.resourceSubType(in.getResourceSubType())
.resourceType(in.getResourceType())
.virtualQuantity(in.getVirtualQuantity())
.virtualQuantityUnits(in.getVirtualQuantityUnits())
.weight(in.getWeight())
.connections(in.getConnections())
.hostResources(in.getHostResources())
.type(in.getType())
.href(in.getHref())
.links(Sets.newLinkedHashSet(in.getLinks()));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder fromManagedElement(ManagedElement in) {
return Builder.class.cast(super.fromManagedElement(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder caption(String caption) {
return Builder.class.cast(super.caption(caption));
}
/**
* {@inheritDoc}
*/
@Override
public Builder description(String description) {
return Builder.class.cast(super.description(description));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
}
} }
/** /**
* The type of resource this allocation setting represents. * The type of resource this allocation setting represents.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum ResourceType { public static enum ResourceType {
@XmlEnumValue("1") OTHER(1),
OTHER(1), COMPUTER_SYSTEM(2), PROCESSOR(3), MEMORY(4), IDE_CONTROLLER(5), PARALLEL_SCSI_HBA(6), FC_HBA(7), ISCSI_HBA( @XmlEnumValue("2") COMPUTER_SYSTEM(2),
8), IB_HCA(9), ETHERNET_ADAPTER(10), OTHER_NETWORK_ADAPTER(11), IO_SLOT(12), IO_DEVICE(13), FLOPPY_DRIVE(14), CD_DRIVE( @XmlEnumValue("3") PROCESSOR(3),
15), DVD_DRIVE(16), DISK_DRIVE(17), TAPE_DRIVE(18), STORAGE_EXTENT(19), OTHER_STORAGE_DEVICE(20), SERIAL_PORT( @XmlEnumValue("4") MEMORY(4),
21), PARALLEL_PORT(22), USB_CONTROLLER(23), GRAPHICS_CONTROLLER(24), IEEE_1394_CONTROLLER(25), PARTITIONABLE_UNIT( @XmlEnumValue("5") IDE_CONTROLLER(5),
26), BASE_PARTITIONABLE_UNIT(27), POWER(28), COOLING_CAPACITY(29), ETHERNET_SWITCH_PORT(30), LOGICAL_DISK( @XmlEnumValue("6") PARALLEL_SCSI_HBA(6),
31), STORAGE_VOLUME(32), ETHERNET_CONNECTION(33), DMTF_RESERVED(Integer.valueOf("8000", 16)), VENDOR_RESERVED( @XmlEnumValue("7") FC_HBA(7),
Integer.valueOf("FFFF", 16)); @XmlEnumValue("8") ISCSI_HBA(8),
@XmlEnumValue("9") IB_HCA(9),
@XmlEnumValue("10") ETHERNET_ADAPTER(10),
@XmlEnumValue("11") OTHER_NETWORK_ADAPTER(11),
@XmlEnumValue("12") IO_SLOT(12),
@XmlEnumValue("13") IO_DEVICE(13),
@XmlEnumValue("14") FLOPPY_DRIVE(14),
@XmlEnumValue("15") CD_DRIVE(15),
@XmlEnumValue("16") DVD_DRIVE(16),
@XmlEnumValue("17") DISK_DRIVE(17),
@XmlEnumValue("18") TAPE_DRIVE(18),
@XmlEnumValue("19") STORAGE_EXTENT(19),
@XmlEnumValue("20") OTHER_STORAGE_DEVICE(20),
@XmlEnumValue("21") SERIAL_PORT(21),
@XmlEnumValue("22") PARALLEL_PORT(22),
@XmlEnumValue("23") USB_CONTROLLER(23),
@XmlEnumValue("24") GRAPHICS_CONTROLLER(24),
@XmlEnumValue("25") IEEE_1394_CONTROLLER(25),
@XmlEnumValue("26") PARTITIONABLE_UNIT(26),
@XmlEnumValue("27") BASE_PARTITIONABLE_UNIT(27),
@XmlEnumValue("28") POWER(28),
@XmlEnumValue("29") COOLING_CAPACITY(29),
@XmlEnumValue("30") ETHERNET_SWITCH_PORT(30),
@XmlEnumValue("31") LOGICAL_DISK(31),
@XmlEnumValue("32") STORAGE_VOLUME(32),
@XmlEnumValue("33") ETHERNET_CONNECTION(33),
@XmlEnumValue("32768") DMTF_RESERVED(Integer.valueOf("8000", 16)),
@XmlEnumValue("65535") VENDOR_RESERVED(Integer.valueOf("FFFF", 16));
protected final int code; protected final int code;
@ -332,47 +420,52 @@ public class ResourceAllocationSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, ResourceType> RESOURCE_TYPE_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, ResourceType> RESOURCE_TYPE_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(ResourceType.values()), new Function<ResourceType, Integer>() { ImmutableSet.copyOf(ResourceType.values()), new Function<ResourceType, Integer>() {
@Override @Override
public Integer apply(ResourceType input) { public Integer apply(ResourceType input) {
return input.code; return input.code;
} }
}); });
public static ResourceType fromValue(String type) { public static ResourceType fromValue(String type) {
return RESOURCE_TYPE_BY_ID.get(new Integer(checkNotNull(type, "type"))); return RESOURCE_TYPE_BY_ID.get(Integer.valueOf(checkNotNull(type, "type")));
} }
} }
/** /**
* Describes the consumers visibility to the allocated resource. * Describes the consumers visibility to the allocated resource.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum ConsumerVisibility { public static enum ConsumerVisibility {
UNKNOWN(0), @XmlEnumValue("0") UNKNOWN(0),
/** /**
* indicates the underlying or host resource is utilized and passed * indicates the underlying or host resource is utilized and passed
* through to the consumer, possibly using partitioning. At least one item * through to the consumer, possibly using partitioning. At least one item
* shall be present in the HostResource property. * shall be present in the HostResource property.
*/ */
PASSED_THROUGH(2), @XmlEnumValue("2") PASSED_THROUGH(2),
/** /**
* indicates the resource is virtualized and may not map directly to an * indicates the resource is virtualized and may not map directly to an
* underlying/host resource. Some implementations may support specific * underlying/host resource. Some implementations may support specific
* assignment for virtualized resources, in which case the host * assignment for virtualized resources, in which case the host
* resource(s) are exposed using the HostResource property. * resource(s) are exposed using the HostResource property.
*/ */
VIRTUALIZED(3), @XmlEnumValue("3") VIRTUALIZED(3),
/** /**
* indicates a representation of the resource does not exist within the * indicates a representation of the resource does not exist within the
* context of the resource consumer. * context of the resource consumer.
*/ */
NOT_REPRESENTED(4), DMTF_RESERVED(32767), VENDOR_RESERVED(65535); @XmlEnumValue("4") NOT_REPRESENTED(4),
@XmlEnumValue("32768") DMTF_RESERVED(Integer.valueOf("8000", 16)),
@XmlEnumValue("65535") VENDOR_RESERVED(Integer.valueOf("FFFF", 16));
protected final int code; protected final int code;
@ -381,21 +474,19 @@ public class ResourceAllocationSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, ConsumerVisibility> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, ConsumerVisibility> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(ConsumerVisibility.values()), new Function<ConsumerVisibility, Integer>() { ImmutableSet.copyOf(ConsumerVisibility.values()), new Function<ConsumerVisibility, Integer>() {
@Override @Override
public Integer apply(ConsumerVisibility input) { public Integer apply(ConsumerVisibility input) {
return input.code; return input.code;
} }
}); });
public static ConsumerVisibility fromValue(String behavior) { public static ConsumerVisibility fromValue(String behavior) {
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior"))); return MAPPING_BEHAVIOR_BY_ID.get(Integer.valueOf(checkNotNull(behavior, "behavior")));
} }
} }
@ -404,9 +495,16 @@ public class ResourceAllocationSettingData extends ManagedElement {
* HostResource array contains any entries, this property reflects how the * HostResource array contains any entries, this property reflects how the
* resource maps to those specific resources. * resource maps to those specific resources.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum MappingBehavior { public static enum MappingBehavior {
UNKNOWN(0), NOT_SUPPORTED(2), DEDICATED(3), SOFT_AFFINITY(4), HARD_AFFINITY(5), DMTF_RESERVED(32767), VENDOR_RESERVED( @XmlEnumValue("0") UNKNOWN(0),
65535); @XmlEnumValue("2") NOT_SUPPORTED(2),
@XmlEnumValue("3") DEDICATED(3),
@XmlEnumValue("4") SOFT_AFFINITY(4),
@XmlEnumValue("5") HARD_AFFINITY(5),
@XmlEnumValue("32768") DMTF_RESERVED(Integer.valueOf("8000", 16)),
@XmlEnumValue("65535") VENDOR_RESERVED(Integer.valueOf("FFFF", 16));
protected final int code; protected final int code;
@ -415,51 +513,85 @@ public class ResourceAllocationSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, MappingBehavior> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, MappingBehavior> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(MappingBehavior.values()), new Function<MappingBehavior, Integer>() { ImmutableSet.copyOf(MappingBehavior.values()), new Function<MappingBehavior, Integer>() {
@Override @Override
public Integer apply(MappingBehavior input) { public Integer apply(MappingBehavior input) {
return input.code; return input.code;
} }
}); });
public static MappingBehavior fromValue(String behavior) { public static MappingBehavior fromValue(String behavior) {
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior"))); return MAPPING_BEHAVIOR_BY_ID.get(Integer.valueOf(checkNotNull(behavior, "behavior")));
} }
} }
protected String address; @XmlElement(name = "ElementName", namespace = VCLOUD_CIM_RASD_NS)
protected String addressOnParent; protected CimString elementName;
protected String allocationUnits; @XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_RASD_NS)
protected Boolean automaticAllocation; protected CimString instanceID;
protected Boolean automaticDeallocation; @XmlElement(name = "Caption", namespace = VCLOUD_CIM_RASD_NS)
protected CimString caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_RASD_NS)
protected CimString description;
@XmlElement(name = "Address", namespace = VCLOUD_CIM_RASD_NS)
protected CimString address;
@XmlElement(name = "AddressOnParent", namespace = VCLOUD_CIM_RASD_NS)
protected CimString addressOnParent;
@XmlElement(name = "AllocationUnits", namespace = VCLOUD_CIM_RASD_NS)
protected CimString allocationUnits;
@XmlElement(name = "AutomaticAllocation", namespace = VCLOUD_CIM_RASD_NS)
protected CimBoolean automaticAllocation;
@XmlElement(name = "AutomaticDeallocation", namespace = VCLOUD_CIM_RASD_NS)
protected CimBoolean automaticDeallocation;
@XmlElement(name = "ConsumerVisibility", namespace = VCLOUD_CIM_RASD_NS)
protected ConsumerVisibility consumerVisibility; protected ConsumerVisibility consumerVisibility;
protected Long limit; @XmlElement(name = "Limit", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedLong limit;
@XmlElement(name = "MappingBehavior", namespace = VCLOUD_CIM_RASD_NS)
protected MappingBehavior mappingBehavior; protected MappingBehavior mappingBehavior;
protected String otherResourceType; @XmlElement(name = "OtherResourceType", namespace = VCLOUD_CIM_RASD_NS)
protected String parent; protected CimString otherResourceType;
protected String poolID; @XmlElement(name = "Parent", namespace = VCLOUD_CIM_RASD_NS)
protected Long reservation; protected CimString parent;
protected String resourceSubType; @XmlElement(name = "PoolID", namespace = VCLOUD_CIM_RASD_NS)
protected CimString poolID;
@XmlElement(name = "Reservation", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedLong reservation;
@XmlElement(name = "ResourceSubType", namespace = VCLOUD_CIM_RASD_NS)
protected CimString resourceSubType;
@XmlElement(name = "ResourceType", namespace = VCLOUD_CIM_RASD_NS)
protected ResourceType resourceType; protected ResourceType resourceType;
protected Long virtualQuantity; @XmlElement(name = "VirtualQuantity", namespace = VCLOUD_CIM_RASD_NS)
protected String virtualQuantityUnits; protected CimUnsignedLong virtualQuantity;
protected Integer weight; @XmlElement(name = "VirtualQuantityUnits", namespace = VCLOUD_CIM_RASD_NS)
protected List<String> connections; protected CimString virtualQuantityUnits;
protected List<String> hostResources; @XmlElement(name = "Weight", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedInt weight;
@XmlElement(name = "Connection", namespace = VCLOUD_CIM_RASD_NS)
protected List<CimString> connections;
@XmlElement(name = "HostResource", namespace = VCLOUD_CIM_RASD_NS)
protected List<CimString> hostResources;
@XmlAttribute(name = "type", namespace = VCLOUD_1_5_NS)
protected String type;
@XmlAttribute(name = "href", namespace = VCLOUD_1_5_NS)
protected 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, private ResourceAllocationSettingData(CimString elementName, CimString instanceID, CimString caption, CimString description,
String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation, CimString address, CimString addressOnParent, CimString allocationUnits, CimBoolean automaticAllocation,
Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit, CimBoolean automaticDeallocation, ConsumerVisibility consumerVisibility, CimUnsignedLong limit,
MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation, MappingBehavior mappingBehavior, CimString otherResourceType, CimString parent, CimString poolID, CimUnsignedLong reservation,
String resourceSubType, ResourceType resourceType, Long virtualQuantity, String virtualQuantityUnits, CimString resourceSubType, ResourceType resourceType, CimUnsignedLong virtualQuantity, CimString virtualQuantityUnits,
Integer weight, List<String> connections, List<String> hostResources) { CimUnsignedInt weight, List<CimString> connections, List<CimString> hostResources, String type, URI href, Set<Link> links) {
super(elementName, instanceID, caption, description); this.elementName = elementName;
this.instanceID = instanceID;
this.caption = caption;
this.description = description;
this.address = address; this.address = address;
this.addressOnParent = addressOnParent; this.addressOnParent = addressOnParent;
this.allocationUnits = allocationUnits; this.allocationUnits = allocationUnits;
@ -479,17 +611,51 @@ public class ResourceAllocationSettingData extends ManagedElement {
this.weight = weight; this.weight = weight;
this.connections = ImmutableList.copyOf(connections); this.connections = ImmutableList.copyOf(connections);
this.hostResources = ImmutableList.copyOf(hostResources); this.hostResources = ImmutableList.copyOf(hostResources);
this.type = type;
this.href = href;
this.links = links != null ? ImmutableSet.copyOf(links) : Collections.<Link>emptySet();
} }
private ResourceAllocationSettingData() { private ResourceAllocationSettingData() {
// for JAXB // for JAXB
} }
/**
* The user-friendly name for this instance of SettingData. In addition, the user-friendly name
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public CimString getElementName() {
return elementName;
}
/**
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public CimString getInstanceID() {
return instanceID;
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public CimString getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public CimString getDescription() {
return description;
}
/** /**
* The address of the resource. For example, the MAC address of a Ethernet * The address of the resource. For example, the MAC address of a Ethernet
* port. * port.
*/ */
public String getAddress() { public CimString getAddress() {
return address; return address;
} }
@ -500,7 +666,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* if the parent is a PCI Controller, this property would specify the PCI * if the parent is a PCI Controller, this property would specify the PCI
* slot of this child device. * slot of this child device.
*/ */
public String getAddressOnParent() { public CimString getAddressOnParent() {
return addressOnParent; return addressOnParent;
} }
@ -514,7 +680,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* value of the Programmatic Units qualifier as defined in Annex C.1 of * value of the Programmatic Units qualifier as defined in Annex C.1 of
* DSP0004 V2.5 or later. * DSP0004 V2.5 or later.
*/ */
public String getAllocationUnits() { public CimString getAllocationUnits() {
return allocationUnits; return allocationUnits;
} }
@ -527,7 +693,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* on time, the media is not present. An explicit operation is required to * on time, the media is not present. An explicit operation is required to
* allocate the resource. * allocate the resource.
*/ */
public Boolean isAutomaticAllocation() { public CimBoolean isAutomaticAllocation() {
return automaticAllocation; return automaticAllocation;
} }
@ -538,7 +704,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* set to false, the resource will remain allocated and must be explicitly * set to false, the resource will remain allocated and must be explicitly
* de-allocated. * de-allocated.
*/ */
public Boolean isAutomaticDeallocation() { public CimBoolean isAutomaticDeallocation() {
return automaticDeallocation; return automaticDeallocation;
} }
@ -557,7 +723,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* for this allocation. The value of the Limit property is expressed in the * for this allocation. The value of the Limit property is expressed in the
* unit specified by the value of the AllocationUnits property. * unit specified by the value of the AllocationUnits property.
*/ */
public Long getLimit() { public CimUnsignedLong getLimit() {
return limit; return limit;
} }
@ -574,7 +740,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* A string that describes the resource type when a well defined value is not * A string that describes the resource type when a well defined value is not
* available and ResourceType has the value "Other". * available and ResourceType has the value "Other".
*/ */
public String getOtherResourceType() { public CimString getOtherResourceType() {
return otherResourceType; return otherResourceType;
} }
@ -582,7 +748,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* The Parent of the resource. For example, a controller for the current * The Parent of the resource. For example, a controller for the current
* allocation * allocation
*/ */
public String getParent() { public CimString getParent() {
return parent; return parent;
} }
@ -591,7 +757,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* allocated from, or which ResourcePool the resource will be allocated from * allocated from, or which ResourcePool the resource will be allocated from
* when the allocation occurs. * when the allocation occurs.
*/ */
public String getPoolID() { public CimString getPoolID() {
return poolID; return poolID;
} }
@ -603,7 +769,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* the Reservation property is expressed in the unit specified by the value * the Reservation property is expressed in the unit specified by the value
* of the AllocationUnits property. * of the AllocationUnits property.
*/ */
public Long getReservation() { public CimUnsignedLong getReservation() {
return reservation; return reservation;
} }
@ -611,7 +777,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* A string describing an implementation specific sub-type for this resource. * A string describing an implementation specific sub-type for this resource.
* F * F
*/ */
public String getResourceSubType() { public CimString getResourceSubType() {
return resourceSubType; return resourceSubType;
} }
@ -631,7 +797,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* VirtualQuantity property should be expressed in units as defined by the * VirtualQuantity property should be expressed in units as defined by the
* value of the VirtualQuantityUnits property. * value of the VirtualQuantityUnits property.
*/ */
public Long getVirtualQuantity() { public CimUnsignedLong getVirtualQuantity() {
return virtualQuantity; return virtualQuantity;
} }
@ -647,7 +813,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* this property shall be a legal value of the Programmatic Units qualifier * this property shall be a legal value of the Programmatic Units qualifier
* as defined in Annex C.1 of DSP0004 V2.5 or later. * as defined in Annex C.1 of DSP0004 V2.5 or later.
*/ */
public String getVirtualQuantityUnits() { public CimString getVirtualQuantityUnits() {
return virtualQuantityUnits; return virtualQuantityUnits;
} }
@ -657,7 +823,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* has no unit of measure, and is only relevant when compared to other * has no unit of measure, and is only relevant when compared to other
* allocations vying for the same host resources. * allocations vying for the same host resources.
*/ */
public Integer getWeight() { public CimUnsignedInt getWeight() {
return weight; return weight;
} }
@ -665,7 +831,7 @@ public class ResourceAllocationSettingData extends ManagedElement {
* 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<String> getConnections() { public List<CimString> getConnections() {
return Collections.unmodifiableList(connections); return Collections.unmodifiableList(connections);
} }
@ -687,30 +853,65 @@ public class ResourceAllocationSettingData extends ManagedElement {
* 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<String> getHostResources() { public List<CimString> getHostResources() {
return Collections.unmodifiableList(hostResources); return Collections.unmodifiableList(hostResources);
} }
public String getType() {
return type;
}
public URI getHref() {
return href;
}
/**
* Set of optional links to an entity or operation associated with this object.
*/
public Set<Link> getLinks() {
return links != null ? ImmutableSet.copyOf(links) : Collections.<Link>emptySet();
}
@Override @Override
public String toString() { public String toString() {
return String return Objects.toStringHelper("")
.format( .add("elementname", elementName)
"[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s]", .add("instanceId", instanceID)
elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, .add("caption", caption)
automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit, .add("description", description)
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, .add("address", address)
virtualQuantity, virtualQuantityUnits, weight); .add("addressOnParent", addressOnParent)
.add("allocationUnits", allocationUnits)
.add("automaticAllocation", automaticAllocation)
.add("automaticDeallocation", automaticDeallocation)
.add("connections", connections)
.add("consumerVisibility", consumerVisibility)
.add("hostResources", hostResources)
.add("limit", limit)
.add("mappingBehavior", mappingBehavior)
.add("otherResourceType", otherResourceType)
.add("parent", parent)
.add("poolID", poolID)
.add("reservation", reservation)
.add("resourceSubType", resourceSubType)
.add("resourceType", resourceType)
.add("virtualQuantity", virtualQuantity)
.add("virtualQuantityUnits", virtualQuantityUnits)
.add("weight", weight)
.add("type", type)
.add("href", href)
.add("links", links)
.toString();
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hashCode(elementName, instanceID, caption, description,
int result = super.hashCode(); address, addressOnParent, allocationUnits,
result = prime * result + ((address == null) ? 0 : address.hashCode()); automaticAllocation, automaticDeallocation, connections,
result = prime * result + ((addressOnParent == null) ? 0 : addressOnParent.hashCode()); consumerVisibility, hostResources, limit, mappingBehavior,
result = prime * result + ((resourceSubType == null) ? 0 : resourceSubType.hashCode()); otherResourceType, parent, poolID, reservation, resourceSubType,
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); resourceType, virtualQuantity, virtualQuantityUnits, weight, type, href, links);
return result;
} }
@Override @Override
@ -721,28 +922,34 @@ public class ResourceAllocationSettingData extends ManagedElement {
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
ResourceAllocationSettingData other = (ResourceAllocationSettingData) obj; ResourceAllocationSettingData that = ResourceAllocationSettingData.class.cast(obj);
if (address == null) { return equal(this.elementName, that.elementName) &&
if (other.address != null) equal(this.instanceID, that.instanceID) &&
return false; equal(this.caption, that.caption) &&
} else if (!address.equals(other.address)) equal(this.description, that.description) &&
return false; equal(this.address, that.address) &&
if (addressOnParent == null) { equal(this.addressOnParent, that.addressOnParent) &&
if (other.addressOnParent != null) equal(this.allocationUnits, that.allocationUnits) &&
return false; equal(this.automaticAllocation, that.automaticAllocation) &&
} else if (!addressOnParent.equals(other.addressOnParent)) equal(this.automaticDeallocation, that.automaticDeallocation) &&
return false; equal(this.connections, that.connections) &&
if (resourceSubType == null) { equal(this.consumerVisibility, that.consumerVisibility) &&
if (other.resourceSubType != null) equal(this.hostResources, that.hostResources) &&
return false; equal(this.limit, that.limit) &&
} else if (!resourceSubType.equals(other.resourceSubType)) equal(this.mappingBehavior, that.mappingBehavior) &&
return false; equal(this.otherResourceType, that.otherResourceType) &&
if (resourceType == null) { equal(this.parent, that.parent) &&
if (other.resourceType != null) equal(this.poolID, that.poolID) &&
return false; equal(this.reservation, that.reservation) &&
} else if (!resourceType.equals(other.resourceType)) equal(this.resourceSubType, that.resourceSubType) &&
return false; equal(this.resourceType, that.resourceType) &&
return true; equal(this.virtualQuantity, that.virtualQuantity) &&
equal(this.virtualQuantityUnits, that.virtualQuantityUnits) &&
equal(this.weight, that.weight) &&
equal(this.type, that.type) &&
equal(this.href, that.href) &&
equal(this.links, that.links);
} }
} }

View File

@ -1,143 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain.cim;
import static com.google.common.base.Preconditions.checkNotNull;
/**
*
* The type of resource this allocation setting represents.
*
* @author Adrian Cole
* @see <a
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
* />
*
*/
public abstract class SettingData implements Comparable<SettingData> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().fromSettingData(this);
}
public static class Builder {
protected String elementName;
protected String instanceID;
/**
* @see SettingData#getElementName
*/
public Builder elementName(String elementName) {
this.elementName = checkNotNull(elementName, "elementName");
return this;
}
/**
* @see SettingData#getInstanceID
*/
public Builder instanceID(String instanceID) {
this.instanceID = checkNotNull(instanceID, "instanceID");
return this;
}
public Builder fromSettingData(SettingData in) {
return elementName(in.getElementName()).instanceID(in.getInstanceID());
}
}
protected String elementName;
protected String instanceID;
public SettingData(String elementName, String instanceID) {
this.elementName = checkNotNull(elementName, "elementName");
this.instanceID = checkNotNull(instanceID, "instanceID");
}
protected SettingData() {
// for JAXB
}
/**
* The user-friendly name for this instance of SettingData. In addition, the user-friendly name
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public String getElementName() {
return elementName;
}
/**
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public String getInstanceID() {
return instanceID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((elementName == null) ? 0 : elementName.hashCode());
result = prime * result + ((instanceID == null) ? 0 : instanceID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SettingData other = (SettingData) obj;
if (elementName == null) {
if (other.elementName != null)
return false;
} else if (!elementName.equals(other.elementName))
return false;
if (instanceID == null) {
if (other.instanceID != null)
return false;
} else if (!instanceID.equals(other.instanceID))
return false;
return true;
}
@Override
public String toString() {
return String.format("[elementName=%s, instanceID=%s]", elementName, instanceID);
}
/**
* {@inheritDoc}
*/
@Override
public int compareTo(SettingData o) {
if (instanceID == null)
return -1;
return (this == o) ? 0 : instanceID.compareTo(o.instanceID);
}
}

View File

@ -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
@ -18,69 +18,100 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.vcloud.director.v1_5.domain.cim;
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 java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/** /**
* VirtualSystemSettingData defines the virtual aspects of a virtual system through a set of
* virtualization specific properties.
* *
* CIM_VirtualSystemSettingData defines the virtual aspects of a virtual system through a set of * VirtualSystemSettingData is also used as the top level class of virtual system configurations.
* virtualization specific properties. CIM_VirtualSystemSettingData is also used as the top level * Virtual system configurations model configuration information about virtual systems and their
* class of virtual system configurations. Virtual system configurations model configuration * components. A virtual system configuration consists of one top-level instance of class
* information about virtual systems and their components. A virtual system configuration consists * VirtualSystemSettingData that aggregates a number of instances of class
* of one top-level instance of class CIM_VirtualSystemSettingData that aggregates a number of * {@link ResourceAllocationSettingData}, using association {@link ConcreteComponent).
* instances of class CIM_ResourceAllocationSettingData, using association CIM_ConcreteComponent. * <p>
* Virtual system configurations may for example be used to reflect configurations of - virtual * Virtual system configurations may for example be used to reflect configurations of:
* systems that are defined at a virtualization platform, - virtual systems that are currently * <ul>
* active, - input requests to create new virtual systems, - input requests to modify existing * <li>virtual systems that are defined at a virtualization platform
* virtual systems, or - snapshots of virtual systems. * <li>virtual systems that are currently active
* <li>input requests to create new virtual systems
* <li>input requests to modify existing virtual systems
* <li>snapshots of virtual systems
* </ul>
* *
* @author Adrian Cole * @author Adrian Cole
* @see <a * @author grkvlt@apache.org
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip" * @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd
* />
*
*/ */
public class VirtualSystemSettingData extends ManagedElement { @XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = VCLOUD_CIM_VSSD_NS)
public class VirtualSystemSettingData {
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() { public Builder toBuilder() {
return builder().fromVirtualSystemSettingData(this); return builder().fromVirtualSystemSettingData(this);
} }
public static class Builder extends ManagedElement.Builder { public static class Builder {
protected CimString elementName;
protected CimString instanceID;
private CimString caption;
private CimString description;
private AutomaticRecoveryAction automaticRecoveryAction; private AutomaticRecoveryAction automaticRecoveryAction;
private AutomaticShutdownAction automaticShutdownAction; private AutomaticShutdownAction automaticShutdownAction;
private AutomaticStartupAction automaticStartupAction; private AutomaticStartupAction automaticStartupAction;
private Long automaticStartupActionDelay; private CimUnsignedLong automaticStartupActionDelay;
private Integer automaticStartupActionSequenceNumber; private CimUnsignedInt automaticStartupActionSequenceNumber;
private URI configurationDataRoot; private CimString configurationDataRoot;
private URI configurationFile; private CimString configurationFile;
private String configurationID; private CimString configurationID;
private Date creationTime; private Date creationTime;
private URI logDataRoot; private CimString logDataRoot;
private URI recoveryFile; private CimString recoveryFile;
private URI snapshotDataRoot; private CimString snapshotDataRoot;
private URI suspendDataRoot; private CimString suspendDataRoot;
private URI swapFileDataRoot; private CimString swapFileDataRoot;
private String virtualSystemIdentifier; private CimString virtualSystemIdentifier;
private Set<String> virtualSystemTypes = Sets.newLinkedHashSet(); private CimString virtualSystemType;
private String notes; private CimString notes;
public Builder elementName(CimString elementName) {
this.elementName = elementName;
return this;
}
public Builder instanceID(CimString instanceID) {
this.instanceID = instanceID;
return this;
}
public Builder caption(CimString caption) {
this.caption = caption;
return this;
}
public Builder description(CimString description) {
this.description = description;
return this;
}
public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) { public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) {
this.automaticRecoveryAction = automaticRecoveryAction; this.automaticRecoveryAction = automaticRecoveryAction;
@ -97,27 +128,27 @@ public class VirtualSystemSettingData extends ManagedElement {
return this; return this;
} }
public Builder automaticStartupActionDelay(Long automaticStartupActionDelay) { public Builder automaticStartupActionDelay(CimUnsignedLong automaticStartupActionDelay) {
this.automaticStartupActionDelay = automaticStartupActionDelay; this.automaticStartupActionDelay = automaticStartupActionDelay;
return this; return this;
} }
public Builder automaticStartupActionSequenceNumber(Integer automaticStartupActionSequenceNumber) { public Builder automaticStartupActionSequenceNumber(CimUnsignedInt automaticStartupActionSequenceNumber) {
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber; this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
return this; return this;
} }
public Builder configurationDataRoot(URI configurationDataRoot) { public Builder configurationDataRoot(CimString configurationDataRoot) {
this.configurationDataRoot = configurationDataRoot; this.configurationDataRoot = configurationDataRoot;
return this; return this;
} }
public Builder configurationFile(URI configurationFile) { public Builder configurationFile(CimString configurationFile) {
this.configurationFile = configurationFile; this.configurationFile = configurationFile;
return this; return this;
} }
public Builder configurationID(String configurationID) { public Builder configurationID(CimString configurationID) {
this.configurationID = configurationID; this.configurationID = configurationID;
return this; return this;
} }
@ -127,47 +158,42 @@ public class VirtualSystemSettingData extends ManagedElement {
return this; return this;
} }
public Builder logDataRoot(URI logDataRoot) { public Builder logDataRoot(CimString logDataRoot) {
this.logDataRoot = logDataRoot; this.logDataRoot = logDataRoot;
return this; return this;
} }
public Builder recoveryFile(URI recoveryFile) { public Builder recoveryFile(CimString recoveryFile) {
this.recoveryFile = recoveryFile; this.recoveryFile = recoveryFile;
return this; return this;
} }
public Builder snapshotDataRoot(URI snapshotDataRoot) { public Builder snapshotDataRoot(CimString snapshotDataRoot) {
this.snapshotDataRoot = snapshotDataRoot; this.snapshotDataRoot = snapshotDataRoot;
return this; return this;
} }
public Builder suspendDataRoot(URI suspendDataRoot) { public Builder suspendDataRoot(CimString suspendDataRoot) {
this.suspendDataRoot = suspendDataRoot; this.suspendDataRoot = suspendDataRoot;
return this; return this;
} }
public Builder swapFileDataRoot(URI swapFileDataRoot) { public Builder swapFileDataRoot(CimString swapFileDataRoot) {
this.swapFileDataRoot = swapFileDataRoot; this.swapFileDataRoot = swapFileDataRoot;
return this; return this;
} }
public Builder virtualSystemIdentifier(String virtualSystemIdentifier) { public Builder virtualSystemIdentifier(CimString virtualSystemIdentifier) {
this.virtualSystemIdentifier = virtualSystemIdentifier; this.virtualSystemIdentifier = virtualSystemIdentifier;
return this; return this;
} }
public Builder virtualSystemTypes(Iterable<String> virtualSystemTypes) { public Builder virtualSystemType(CimString virtualSystemType) {
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes")); this.virtualSystemType = virtualSystemType;
return this; return this;
} }
public Builder virtualSystemType(String virtualSystemType) { public Builder notes(CimString notes) {
this.virtualSystemTypes.add(checkNotNull(virtualSystemType, "virtualSystemType"));
return this;
}
public Builder notes(String notes) {
this.notes = notes; this.notes = notes;
return this; return this;
} }
@ -177,77 +203,48 @@ public class VirtualSystemSettingData extends ManagedElement {
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay, automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID, automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID,
creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot, creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot,
virtualSystemIdentifier, virtualSystemTypes, notes); virtualSystemIdentifier, virtualSystemType, notes);
} }
public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) { public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) {
return fromManagedElement(in).automaticRecoveryAction(in.getAutomaticRecoveryAction()) return elementName(in.getElementName())
.automaticShutdownAction(in.getAutomaticShutdownAction()).automaticStartupAction( .instanceID(in.getInstanceID())
in.getAutomaticStartupAction()).automaticStartupActionDelay( .caption(in.getCaption())
in.getAutomaticStartupActionDelay()).automaticStartupActionSequenceNumber( .description(in.getDescription())
in.getAutomaticStartupActionSequenceNumber()).configurationDataRoot( .automaticRecoveryAction(in.getAutomaticRecoveryAction())
in.getConfigurationDataRoot()).configurationFile(in.getConfigurationFile()).configurationID( .automaticShutdownAction(in.getAutomaticShutdownAction())
in.getConfigurationID()).creationTime(in.getCreationTime()).logDataRoot(in.getLogDataRoot()) .automaticStartupAction(in.getAutomaticStartupAction())
.recoveryFile(in.getRecoveryFile()).snapshotDataRoot(in.getSnapshotDataRoot()).suspendDataRoot( .automaticStartupActionDelay(in.getAutomaticStartupActionDelay())
in.getSuspendDataRoot()).swapFileDataRoot(in.getSwapFileDataRoot()).virtualSystemIdentifier( .automaticStartupActionSequenceNumber(in.getAutomaticStartupActionSequenceNumber())
in.getVirtualSystemIdentifier()).virtualSystemTypes(in.getVirtualSystemTypes()).notes( .configurationDataRoot(in.getConfigurationDataRoot())
in.getNotes()); .configurationFile(in.getConfigurationFile())
} .configurationID(in.getConfigurationID())
.creationTime(in.getCreationTime())
/** .logDataRoot(in.getLogDataRoot())
* {@inheritDoc} .recoveryFile(in.getRecoveryFile())
*/ .snapshotDataRoot(in.getSnapshotDataRoot())
@Override .suspendDataRoot(in.getSuspendDataRoot())
public Builder fromManagedElement(ManagedElement in) { .swapFileDataRoot(in.getSwapFileDataRoot())
return Builder.class.cast(super.fromManagedElement(in)); .virtualSystemIdentifier(in.getVirtualSystemIdentifier())
} .virtualSystemType(in.getVirtualSystemType())
.notes(in.getNotes());
/**
* {@inheritDoc}
*/
@Override
public Builder caption(String caption) {
return Builder.class.cast(super.caption(caption));
}
/**
* {@inheritDoc}
*/
@Override
public Builder description(String description) {
return Builder.class.cast(super.description(description));
}
/**
* {@inheritDoc}
*/
@Override
public Builder elementName(String elementName) {
return Builder.class.cast(super.elementName(elementName));
}
/**
* {@inheritDoc}
*/
@Override
public Builder instanceID(String instanceID) {
return Builder.class.cast(super.instanceID(instanceID));
} }
} }
/** /**
* Action to take for the virtual system when the software executed by the virtual system fails. * Action to take for the virtual system when the software executed by the virtual system fails.
*
* Failures in this case means a failure that is detectable by the host platform, such as a * Failures in this case means a failure that is detectable by the host platform, such as a
* non-interuptable wait state condition. * non-interuptable wait state condition.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum AutomaticRecoveryAction { public static enum AutomaticRecoveryAction {
NONE(2), @XmlEnumValue("2") NONE(2),
@XmlEnumValue("3") RESTART(3),
RESTART(3), @XmlEnumValue("4") REVERT_TO_SNAPSHOT(4);
REVERT_TO_SNAPSHOT(4);
protected final int code; protected final int code;
@ -256,35 +253,32 @@ public class VirtualSystemSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, AutomaticRecoveryAction> AUTOMATIC_RECOVERY_ACTION_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, AutomaticRecoveryAction> AUTOMATIC_RECOVERY_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticRecoveryAction.values()), new Function<AutomaticRecoveryAction, Integer>() { ImmutableSet.copyOf(AutomaticRecoveryAction.values()), new Function<AutomaticRecoveryAction, Integer>() {
@Override @Override
public Integer apply(AutomaticRecoveryAction input) { public Integer apply(AutomaticRecoveryAction input) {
return input.code; return input.code;
} }
}); });
public static AutomaticRecoveryAction fromValue(String automaticRecoveryAction) { public static AutomaticRecoveryAction fromValue(String automaticRecoveryAction) {
return AUTOMATIC_RECOVERY_ACTION_BY_ID.get(new Integer(checkNotNull(automaticRecoveryAction, return AUTOMATIC_RECOVERY_ACTION_BY_ID.get(Integer.valueOf(checkNotNull(automaticRecoveryAction, "automaticRecoveryAction")));
"automaticRecoveryAction")));
} }
} }
/** /**
* Action to take for the virtual system when the host is shut down. * Action to take for the virtual system when the host is shut down.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum AutomaticShutdownAction { public static enum AutomaticShutdownAction {
TURN_OFF(2), @XmlEnumValue("2") TURN_OFF(2),
@XmlEnumValue("3") SAVE_STATE(3),
SAVE_STATE(3), @XmlEnumValue("4") SHUTDOWN(4);
SHUTDOWN(4);
protected final int code; protected final int code;
@ -293,35 +287,32 @@ public class VirtualSystemSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, AutomaticShutdownAction> AUTOMATIC_SHUTDOWN_ACTION_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, AutomaticShutdownAction> AUTOMATIC_SHUTDOWN_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticShutdownAction.values()), new Function<AutomaticShutdownAction, Integer>() { ImmutableSet.copyOf(AutomaticShutdownAction.values()), new Function<AutomaticShutdownAction, Integer>() {
@Override @Override
public Integer apply(AutomaticShutdownAction input) { public Integer apply(AutomaticShutdownAction input) {
return input.code; return input.code;
} }
}); });
public static AutomaticShutdownAction fromValue(String automaticShutdownAction) { public static AutomaticShutdownAction fromValue(String automaticShutdownAction) {
return AUTOMATIC_SHUTDOWN_ACTION_BY_ID.get(new Integer(checkNotNull(automaticShutdownAction, return AUTOMATIC_SHUTDOWN_ACTION_BY_ID.get(Integer.valueOf(checkNotNull(automaticShutdownAction, "automaticShutdownAction")));
"automaticShutdownAction")));
} }
} }
/** /**
* Action to take for the virtual system when the host is started. * Action to take for the virtual system when the host is started.
*/ */
@XmlType
@XmlEnum(Integer.class)
public static enum AutomaticStartupAction { public static enum AutomaticStartupAction {
NONE(2), @XmlEnumValue("2") NONE(2),
@XmlEnumValue("3") RESTART_IF_PREVIOUSLY_ACTIVE(3),
RESTART_IF_PREVIOUSLY_ACTIVE(3), @XmlEnumValue("4") ALWAYS_STARTUP(4);
ALWAYS_STARTUP(4);
protected final int code; protected final int code;
@ -330,51 +321,76 @@ public class VirtualSystemSettingData extends ManagedElement {
} }
public String value() { public String value() {
return code + ""; return Integer.toString(code);
} }
protected final static Map<Integer, AutomaticStartupAction> AUTOMATIC_STARTUP_ACTION_BY_ID = Maps.uniqueIndex( protected final static Map<Integer, AutomaticStartupAction> AUTOMATIC_STARTUP_ACTION_BY_ID = Maps.uniqueIndex(
ImmutableSet.copyOf(AutomaticStartupAction.values()), new Function<AutomaticStartupAction, Integer>() { ImmutableSet.copyOf(AutomaticStartupAction.values()), new Function<AutomaticStartupAction, Integer>() {
@Override @Override
public Integer apply(AutomaticStartupAction input) { public Integer apply(AutomaticStartupAction input) {
return input.code; return input.code;
} }
}); });
public static AutomaticStartupAction fromValue(String automaticStartupAction) { public static AutomaticStartupAction fromValue(String automaticStartupAction) {
return AUTOMATIC_STARTUP_ACTION_BY_ID.get(new Integer(checkNotNull(automaticStartupAction, return AUTOMATIC_STARTUP_ACTION_BY_ID.get(Integer.valueOf(checkNotNull(automaticStartupAction, "automaticStartupAction")));
"automaticStartupAction")));
} }
} }
@XmlElement(name = "ElementName", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString elementName;
@XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString instanceID;
@XmlElement(name = "Caption", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString description;
@XmlElement(name = "VirtualSystemIdentifier", namespace = VCLOUD_CIM_VSSD_NS)
private CimString virtualSystemIdentifier;
@XmlElement(name = "VirtualSystemType", namespace = VCLOUD_CIM_VSSD_NS)
private CimString virtualSystemType;
@XmlElement(name = "AutomaticRecoveryAction", namespace = VCLOUD_CIM_VSSD_NS)
private AutomaticRecoveryAction automaticRecoveryAction; private AutomaticRecoveryAction automaticRecoveryAction;
@XmlElement(name = "AutomaticShutdownAction", namespace = VCLOUD_CIM_VSSD_NS)
private AutomaticShutdownAction automaticShutdownAction; private AutomaticShutdownAction automaticShutdownAction;
@XmlElement(name = "AutomaticStartupAction", namespace = VCLOUD_CIM_VSSD_NS)
private AutomaticStartupAction automaticStartupAction; private AutomaticStartupAction automaticStartupAction;
private Long automaticStartupActionDelay; @XmlElement(name = "AutomaticStartupActionDelay", namespace = VCLOUD_CIM_VSSD_NS)
private Integer automaticStartupActionSequenceNumber; private CimUnsignedLong automaticStartupActionDelay;
private URI configurationDataRoot; @XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = VCLOUD_CIM_VSSD_NS)
private URI configurationFile; private CimUnsignedInt automaticStartupActionSequenceNumber;
private String configurationID; @XmlElement(name = "ConfigurationDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationDataRoot;
@XmlElement(name = "ConfigurationFile", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationFile;
@XmlElement(name = "ConfigurationID", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationID;
@XmlElement(name = "CreationTime", namespace = VCLOUD_CIM_VSSD_NS)
private Date creationTime; private Date creationTime;
private URI logDataRoot; @XmlElement(name = "LogDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private URI recoveryFile; private CimString logDataRoot;
private URI snapshotDataRoot; @XmlElement(name = "RecoveryFile", namespace = VCLOUD_CIM_VSSD_NS)
private URI suspendDataRoot; private CimString recoveryFile;
private URI swapFileDataRoot; @XmlElement(name = "SnapshotDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private String virtualSystemIdentifier; private CimString snapshotDataRoot;
private Set<String> virtualSystemTypes; @XmlElement(name = "SuspendDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private String notes; private CimString suspendDataRoot;
@XmlElement(name = "SwapFileDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString swapFileDataRoot;
@XmlElement(name = "Notes", namespace = VCLOUD_CIM_VSSD_NS)
private CimString notes;
private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description, private VirtualSystemSettingData(CimString elementName, CimString instanceID, CimString caption, CimString description,
AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction, AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction,
AutomaticStartupAction automaticStartupAction, Long automaticStartupActionDelay, AutomaticStartupAction automaticStartupAction, CimUnsignedLong automaticStartupActionDelay,
Integer automaticStartupActionSequenceNumber, URI configurationDataRoot, URI configurationFile, CimUnsignedInt automaticStartupActionSequenceNumber, CimString configurationDataRoot, CimString configurationFile,
String configurationID, Date creationTime, URI logDataRoot, URI recoveryFile, URI snapshotDataRoot, CimString configurationID, Date creationTime, CimString logDataRoot, CimString recoveryFile, CimString snapshotDataRoot,
URI suspendDataRoot, URI swapFileDataRoot, String virtualSystemIdentifier, CimString suspendDataRoot, CimString swapFileDataRoot, CimString virtualSystemIdentifier,
Iterable<String> virtualSystemTypes, String notes) { CimString virtualSystemType, CimString notes) {
super(elementName, instanceID, caption, description); this.elementName = elementName;
this.instanceID = instanceID;
this.caption = caption;
this.description = description;
this.automaticRecoveryAction = automaticRecoveryAction; this.automaticRecoveryAction = automaticRecoveryAction;
this.automaticShutdownAction = automaticShutdownAction; this.automaticShutdownAction = automaticShutdownAction;
this.automaticStartupAction = automaticStartupAction; this.automaticStartupAction = automaticStartupAction;
@ -390,7 +406,7 @@ public class VirtualSystemSettingData extends ManagedElement {
this.suspendDataRoot = suspendDataRoot; this.suspendDataRoot = suspendDataRoot;
this.swapFileDataRoot = swapFileDataRoot; this.swapFileDataRoot = swapFileDataRoot;
this.virtualSystemIdentifier = virtualSystemIdentifier; this.virtualSystemIdentifier = virtualSystemIdentifier;
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes")); this.virtualSystemType = virtualSystemType;
this.notes = notes; this.notes = notes;
} }
@ -398,6 +414,37 @@ public class VirtualSystemSettingData extends ManagedElement {
// for JAXB // for JAXB
} }
/**
* The user-friendly name for this instance of SettingData. In addition, the user-friendly name
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public CimString getElementName() {
return elementName;
}
/**
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public CimString getInstanceID() {
return instanceID;
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public CimString getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public CimString getDescription() {
return description;
}
/** /**
* Action to take for the virtual system when the software executed by the virtual system fails. * Action to take for the virtual system when the software executed by the virtual system fails.
* Failures in this case means a failure that is detectable by the host platform, such as a * Failures in this case means a failure that is detectable by the host platform, such as a
@ -425,7 +472,7 @@ public class VirtualSystemSettingData extends ManagedElement {
* Delay applicable to startup action. The value shall be in the interval variant of the datetime * Delay applicable to startup action. The value shall be in the interval variant of the datetime
* datatype. * datatype.
*/ */
public Long getAutomaticStartupActionDelay() { public CimUnsignedLong getAutomaticStartupActionDelay() {
return automaticStartupActionDelay; return automaticStartupActionDelay;
} }
@ -435,24 +482,28 @@ public class VirtualSystemSettingData extends ManagedElement {
* same value, the sequence is implementation dependent. A value of 0 indicates that the sequence * same value, the sequence is implementation dependent. A value of 0 indicates that the sequence
* is implementation dependent. * is implementation dependent.
*/ */
public Integer getAutomaticStartupActionSequenceNumber() { public CimUnsignedInt getAutomaticStartupActionSequenceNumber() {
return automaticStartupActionSequenceNumber; return automaticStartupActionSequenceNumber;
} }
/** /**
* Filepath of a directory where information about the virtual system configuration is * Filepath of a directory where information about the virtual system configuration is
* stored.Format shall be URI based on RFC 2079. * stored.
*
* Format shall be CimString based on RFC-2079.
*/ */
public URI getConfigurationDataRoot() { public CimString getConfigurationDataRoot() {
return configurationDataRoot; return configurationDataRoot;
} }
/** /**
* Filepath of a file where information about the virtual system configuration is stored. A * Filepath of a file where information about the virtual system configuration is stored.
* relative path appends to the value of the ConfigurationDataRoot property.Format shall be URI *
* based on RFC 2079. * A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
*/ */
public URI getConfigurationFile() { public CimString getConfigurationFile() {
return configurationFile; return configurationFile;
} }
@ -461,7 +512,7 @@ public class VirtualSystemSettingData extends ManagedElement {
* the InstanceID as it is assigned by the implementation to a virtual system or a virtual system * the InstanceID as it is assigned by the implementation to a virtual system or a virtual system
* configuration. It is not a key, and the same value may occur within more than one instance. * configuration. It is not a key, and the same value may occur within more than one instance.
*/ */
public String getConfigurationID() { public CimString getConfigurationID() {
return configurationID; return configurationID;
} }
@ -473,81 +524,89 @@ public class VirtualSystemSettingData extends ManagedElement {
} }
/** /**
* Filepath of a directory where log information about the virtual system is stored. A relative * Filepath of a directory where log information about the virtual system is stored.
* path appends to the value of the ConfigurationDataRoot property.Format shall be URI based on *
* RFC 2079. * A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
*/ */
public URI getLogDataRoot() { public CimString getLogDataRoot() {
return logDataRoot; return logDataRoot;
} }
/** /**
* Filepath of a file where recovery relateded information of the virtual system is stored.Format * Filepath of a file where recovery relateded information of the virtual system is stored.
* shall be URI based on RFC 2079. *
* Format shall be CimString based on RFC-2079.
*/ */
public URI getRecoveryFile() { public CimString getRecoveryFile() {
return recoveryFile; return recoveryFile;
} }
/** /**
* Filepath of a directory where information about virtual system snapshots is stored. A relative * Filepath of a directory where information about virtual system snapshots is stored.
* path appends to the value of the ConfigurationDataRoot property.Format shall be URI based on *
* RFC 2079. * A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
*/ */
public URI getSnapshotDataRoot() { public CimString getSnapshotDataRoot() {
return snapshotDataRoot; return snapshotDataRoot;
} }
/** /**
* Filepath of a directory where suspend related information about the virtual system is stored. * Filepath of a directory where suspend related information about the virtual system is stored.
* A relative path appends to the value of the ConfigurationDataRoot property.Format shall be URI *
* based on RFC 2079. * A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
*/ */
public URI getSuspendDataRoot() { public CimString getSuspendDataRoot() {
return suspendDataRoot; return suspendDataRoot;
} }
/** /**
* Filepath of a directory where swapfiles of the virtual system are stored. A relative path * Filepath of a directory where swapfiles of the virtual system are stored.
* appends to the value of the ConfigurationDataRoot property.Format shall be URI based on RFC *
* 2079. * A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
*/ */
public URI getSwapFileDataRoot() { public CimString getSwapFileDataRoot() {
return swapFileDataRoot; return swapFileDataRoot;
} }
/** /**
* VirtualSystemIdentifier shall reflect a unique name for the system as it is used within the * VirtualSystemIdentifier shall reflect a unique name for the system as it is used within the
* virtualization platform. Note that the VirtualSystemIdentifier is not the hostname assigned to * virtualization platform.
*
* Note that the VirtualSystemIdentifier is not the hostname assigned to
* the operating system instance running within the virtual system, nor is it an IP address or * the operating system instance running within the virtual system, nor is it an IP address or
* MAC address assigned to any of its network ports. On create requests VirtualSystemIdentifier * MAC address assigned to any of its network ports. On create requests VirtualSystemIdentifier
* may contain implementation specific rules (like simple patterns or regular expresssion) that * may contain implementation specific rules (like simple patterns or regular expresssion) that
* may be interpreted by the implementation when assigning a VirtualSystemIdentifier. * may be interpreted by the implementation when assigning a VirtualSystemIdentifier.
*/ */
public String getVirtualSystemIdentifier() { public CimString getVirtualSystemIdentifier() {
return virtualSystemIdentifier; return virtualSystemIdentifier;
} }
/** /**
* VirtualSystemType shall reflect a particular type of virtual system. * VirtualSystemType shall reflect a particular type of virtual system.
*/ */
public Set<String> getVirtualSystemTypes() { public CimString getVirtualSystemType() {
return virtualSystemTypes; return virtualSystemType;
} }
/** /**
* End-user supplied notes that are related to the virtual system. * End-user supplied notes that are related to the virtual system.
*/ */
public String getNotes() { public CimString getNotes() {
return notes; return notes;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hashCode(elementName, instanceID, caption, description, virtualSystemIdentifier, virtualSystemType);
int result = super.hashCode();
result = prime * result + ((virtualSystemIdentifier == null) ? 0 : virtualSystemIdentifier.hashCode());
return result;
} }
@Override @Override
@ -558,25 +617,23 @@ public class VirtualSystemSettingData extends ManagedElement {
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
VirtualSystemSettingData other = (VirtualSystemSettingData) obj; VirtualSystemSettingData that = VirtualSystemSettingData.class.cast(obj);
if (virtualSystemIdentifier == null) { return equal(this.elementName, that.elementName) &&
if (other.virtualSystemIdentifier != null) equal(this.instanceID, that.instanceID) &&
return false; equal(this.caption, that.caption) &&
} else if (!virtualSystemIdentifier.equals(other.virtualSystemIdentifier)) equal(this.description, that.description) &&
return false; equal(this.virtualSystemIdentifier, that.virtualSystemIdentifier) &&
return true; equal(this.virtualSystemType, that.virtualSystemType);
} }
@Override @Override
public String toString() { public String toString() {
return String return Objects.toStringHelper("")
.format( .add("caption", caption)
"[elementName=%s, instanceID=%s, caption=%s, description=%s, automaticRecoveryAction=%s, automaticShutdownAction=%s, automaticStartupAction=%s, automaticStartupActionDelay=%s, automaticStartupActionSequenceNumber=%s, configurationDataRoot=%s, configurationFile=%s, configurationID=%s, creationTime=%s, logDataRoot=%s, notes=%s, recoveryFile=%s, snapshotDataRoot=%s, suspendDataRoot=%s, swapFileDataRoot=%s, virtualSystemIdentifier=%s, virtualSystemTypes=%s]", .add("description", description)
elementName, instanceID, caption, description, automaticRecoveryAction, .add("virtualSystemIdentifier", virtualSystemIdentifier)
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay, .add("virtualSystemType", virtualSystemType)
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, .toString();
configurationID, creationTime, logDataRoot, notes, recoveryFile, snapshotDataRoot,
suspendDataRoot, swapFileDataRoot, virtualSystemIdentifier, virtualSystemTypes);
} }
} }

View File

@ -16,14 +16,26 @@
* 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 = VCLOUD_CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS),
@XmlNs(prefix = "vssd", namespaceURI = VCLOUD_CIM_VSSD_NS),
@XmlNs(prefix = "rasd", namespaceURI = VCLOUD_CIM_RASD_NS),
@XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS)
}
)
// http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
package org.jclouds.vcloud.director.v1_5.domain.cim; package org.jclouds.vcloud.director.v1_5.domain.cim;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_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;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlSchema;

View File

@ -1,17 +1,28 @@
// /*
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 * Licensed to jclouds, Inc. (jclouds) under one or more
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> * contributor license agreements. See the NOTICE file
// Any modifications to this file will be lost upon recompilation of the source schema. * distributed with this work for additional information
// Generated on: 2012.02.08 at 02:47:44 PM GMT * regarding copyright ownership. jclouds licenses this file
// * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Objects.equal;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
@ -19,11 +30,10 @@ import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import com.google.common.base.Objects;
/** /**
* <p>Java class for anonymous complex type. * Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* *
* <pre> * <pre>
* &lt;complexType> * &lt;complexType>
@ -41,82 +51,51 @@ import javax.xml.namespace.QName;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlType(name = "") @XmlType
@XmlSeeAlso({ @XmlSeeAlso({
StartupSectionItem.class StartupSectionItem.class
}) })
public class Item { public class Item {
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1", required = true) // TODO Builder
@XmlAttribute(required = true)
protected String id; protected String id;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1", required = true) @XmlAttribute(required = true)
@XmlSchemaType(name = "unsignedShort") @XmlSchemaType(name = "unsignedShort")
protected int order; protected int order;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlAttribute
@XmlSchemaType(name = "unsignedShort") @XmlSchemaType(name = "unsignedShort")
protected Integer startDelay; protected Integer startDelay;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlAttribute
protected Boolean waitingForGuest; protected Boolean waitingForGuest;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlAttribute
@XmlSchemaType(name = "unsignedShort") @XmlSchemaType(name = "unsignedShort")
protected Integer stopDelay; protected Integer stopDelay;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlAttribute
protected String startAction; protected String startAction;
@XmlAttribute(namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlAttribute
protected String stopAction; protected String stopAction;
@XmlAnyAttribute @XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>(); private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/** /**
* Gets the value of the id property. * Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/ */
public String getId() { public String getId() {
return id; return id;
} }
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/** /**
* Gets the value of the order property. * Gets the value of the order property.
*
*/ */
public int getOrder() { public int getOrder() {
return order; return order;
} }
/**
* Sets the value of the order property.
*
*/
public void setOrder(int value) {
this.order = value;
}
/** /**
* Gets the value of the startDelay property. * Gets the value of the startDelay property.
*
* @return
* possible object is
* {@link Integer }
*
*/ */
public int getStartDelay() { public int getStartDelay() {
if (startDelay == null) { if (startDelay == null) {
@ -126,25 +105,8 @@ public class Item {
} }
} }
/**
* Sets the value of the startDelay property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStartDelay(Integer value) {
this.startDelay = value;
}
/** /**
* Gets the value of the waitingForGuest property. * Gets the value of the waitingForGuest property.
*
* @return
* possible object is
* {@link Boolean }
*
*/ */
public boolean isWaitingForGuest() { public boolean isWaitingForGuest() {
if (waitingForGuest == null) { if (waitingForGuest == null) {
@ -154,25 +116,8 @@ public class Item {
} }
} }
/**
* Sets the value of the waitingForGuest property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setWaitingForGuest(Boolean value) {
this.waitingForGuest = value;
}
/** /**
* Gets the value of the stopDelay property. * Gets the value of the stopDelay property.
*
* @return
* possible object is
* {@link Integer }
*
*/ */
public int getStopDelay() { public int getStopDelay() {
if (stopDelay == null) { if (stopDelay == null) {
@ -182,25 +127,8 @@ public class Item {
} }
} }
/**
* Sets the value of the stopDelay property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStopDelay(Integer value) {
this.stopDelay = value;
}
/** /**
* Gets the value of the startAction property. * Gets the value of the startAction property.
*
* @return
* possible object is
* {@link String }
*
*/ */
public String getStartAction() { public String getStartAction() {
if (startAction == null) { if (startAction == null) {
@ -210,25 +138,8 @@ public class Item {
} }
} }
/**
* Sets the value of the startAction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStartAction(String value) {
this.startAction = value;
}
/** /**
* Gets the value of the stopAction property. * Gets the value of the stopAction property.
*
* @return
* possible object is
* {@link String }
*
*/ */
public String getStopAction() { public String getStopAction() {
if (stopAction == null) { if (stopAction == null) {
@ -238,34 +149,46 @@ public class Item {
} }
} }
/**
* Sets the value of the stopAction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStopAction(String value) {
this.stopAction = value;
}
/** /**
* Gets a map that contains attributes that aren't bound to any typed property on this class. * Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/ */
public Map<QName, String> getOtherAttributes() { public Map<QName, String> getOtherAttributes() {
return otherAttributes; return otherAttributes;
} }
@Override
public int hashCode() {
return Objects.hashCode(id, order, startDelay, waitingForGuest, stopDelay, startAction, stopAction);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Item that = Item.class.cast(obj);
return equal(this.id, that.id) &&
equal(this.order, that.order) &&
equal(this.startDelay, that.startDelay) &&
equal(this.waitingForGuest, that.waitingForGuest) &&
equal(this.stopDelay, that.stopDelay) &&
equal(this.startAction, that.startAction) &&
equal(this.stopAction, that.stopAction);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("id", id)
.add("order", order)
.add("startDelay", startDelay)
.add("waitingForGuest", waitingForGuest)
.add("stopDelay", stopDelay)
.add("startAction", startAction)
.add("stopAction", stopAction)
.toString();
}
} }

View File

@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain.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 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,6 +31,7 @@ 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 org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -44,6 +46,7 @@ import com.google.common.collect.Sets;
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlRootElement(name = "OperatingSystemSection") @XmlRootElement(name = "OperatingSystemSection")
@XmlType
public class OperatingSystemSection extends SectionType { public class OperatingSystemSection extends SectionType {
public static Builder<?> builder() { public static Builder<?> builder() {
@ -58,7 +61,7 @@ public class OperatingSystemSection extends SectionType {
} }
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> { public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
private Integer id; private int id;
private String description; private String description;
private String version; private String version;
private String osType; private String osType;
@ -69,7 +72,7 @@ public class OperatingSystemSection extends SectionType {
/** /**
* @see OperatingSystemSection#getId() * @see OperatingSystemSection#getId()
*/ */
public B id(Integer id) { public B id(int id) {
this.id = id; this.id = id;
return self(); return self();
} }
@ -141,16 +144,17 @@ public class OperatingSystemSection extends SectionType {
} }
public B fromOperatingSystemSection(OperatingSystemSection in) { public B fromOperatingSystemSection(OperatingSystemSection in) {
return fromSectionType(in).id(in.getId()).version(in.getVersion()).description(in.getDescription()) return fromSectionType(in)
.id(in.getId()).version(in.getVersion()).description(in.getDescription())
.osType(in.getOsType()).href(in.getHref()).type(in.getType()).links(in.getLinks()); .osType(in.getOsType()).href(in.getHref()).type(in.getType()).links(in.getLinks());
} }
} }
@XmlAttribute(required = true) @XmlAttribute(namespace = VCLOUD_OVF_NS, required = true)
protected Integer id; protected int id;
@XmlAttribute @XmlAttribute
protected String version; protected String version;
@XmlElement @XmlElement(name = "Description")
protected String description; protected String description;
@XmlAttribute(namespace = VCLOUD_VMW_NS) @XmlAttribute(namespace = VCLOUD_VMW_NS)
protected String osType; protected String osType;
@ -181,7 +185,7 @@ public class OperatingSystemSection extends SectionType {
* *
* @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode() * @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode()
*/ */
public Integer getId() { public int getId() {
return id; return id;
} }
@ -230,7 +234,7 @@ public class OperatingSystemSection extends SectionType {
* @see ResourceType#getLinks() * @see ResourceType#getLinks()
*/ */
public Set<Link> getLinks() { public Set<Link> getLinks() {
return links == null ? ImmutableSet.<Link>of() : Collections.unmodifiableSet(links); return links == null ? Sets.<Link>newLinkedHashSet() : ImmutableSet.copyOf(links);
} }
@Override @Override

View File

@ -18,8 +18,14 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Collections;
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.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
@ -28,11 +34,14 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection; 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.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; 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.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection; import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
* Metadata about a virtual machine or grouping of them. * Metadata about a virtual machine or grouping of them.
@ -41,6 +50,7 @@ import com.google.common.base.Objects;
* *
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
* @author grkvlt@apache.org
*/ */
@XmlType(name = "Section_Type") @XmlType(name = "Section_Type")
@XmlSeeAlso({ @XmlSeeAlso({
@ -63,6 +73,7 @@ public abstract class SectionType {
public static abstract class Builder<B extends Builder<B>> { public static abstract class Builder<B extends Builder<B>> {
private String info; private String info;
private Boolean required; private Boolean required;
private Set<Link> links = Sets.newLinkedHashSet();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected B self() { protected B self() {
@ -103,19 +114,40 @@ public abstract class SectionType {
return self(); return self();
} }
/**
* @see ResourceType#getLinks()
*/
public B links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
return self();
}
/**
* @see ResourceType#getLinks()
*/
public B link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return self();
}
public B fromSectionType(SectionType in) { public B fromSectionType(SectionType in) {
return info(in.getInfo()).required(in.isRequired()); return info(in.getInfo()).required(in.isRequired()).links(Sets.newLinkedHashSet(in.getLinks()));
} }
} }
@XmlElement(name = "Info") @XmlElement(name = "Info", required = true)
private String info; private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS) @XmlAttribute(namespace = VCLOUD_OVF_NS)
private Boolean required; private Boolean required;
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
private Set<Link> links = Sets.newLinkedHashSet();
protected SectionType(Builder<?> builder) { protected SectionType(Builder<?> builder) {
this.info = builder.info; this.info = builder.info;
this.required = builder.required; this.required = builder.required;
this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Collections.<Link>emptySet();
} }
protected SectionType() { protected SectionType() {
@ -139,9 +171,16 @@ public abstract class SectionType {
return required; return required;
} }
/**
* 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 int hashCode() { public int hashCode() {
return Objects.hashCode(info, required); return Objects.hashCode(info, required, links);
} }
@Override @Override
@ -153,7 +192,7 @@ public abstract class SectionType {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
SectionType other = (SectionType) obj; SectionType other = (SectionType) obj;
return Objects.equal(this.info, other.info) && Objects.equal(this.required, other.required); return equal(this.info, other.info) && equal(this.required, other.required) && equal(this.links, other.links);
} }
@Override @Override
@ -162,7 +201,7 @@ public abstract class SectionType {
} }
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("info", info).add("required", required); return Objects.toStringHelper("").add("info", info).add("required", required).add("links", links);
} }
} }

View File

@ -24,13 +24,13 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
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 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.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/** /**
* Specifies the order in which entities in a VirtualSystemCollection are powered on and shut down * Specifies the order in which entities in a VirtualSystemCollection are powered on and shut down
@ -55,8 +55,7 @@ public class StartupSection extends SectionType {
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> { public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
private List<StartupSectionItem> items = Collections.emptyList(); private List<StartupSectionItem> items = Lists.newArrayList();
private List<Object> any = Collections.emptyList();
/** /**
* @see StartupSection#getItem() * @see StartupSection#getItem()
@ -74,28 +73,18 @@ public class StartupSection extends SectionType {
return self(); return self();
} }
/**
* @see StartupSection#getAny()
*/
public B any(List<Object> any) {
this.any = any;
return self();
}
@Override @Override
public StartupSection build() { public StartupSection build() {
return new StartupSection(this); return new StartupSection(this);
} }
public B fromStartupSection(StartupSection in) { public B fromStartupSection(StartupSection in) {
return fromSectionType(in).items(items).any(any); return fromSectionType(in).items(in.getItems());
} }
} }
@XmlElement(name = "Item") @XmlElement(name = "Item")
private List<StartupSectionItem> items; private List<StartupSectionItem> items = Lists.newArrayList();
@XmlAnyElement(lax = true)
private List<Object> any;
protected StartupSection() { protected StartupSection() {
// For JAXB // For JAXB
@ -104,23 +93,15 @@ public class StartupSection extends SectionType {
public StartupSection(Builder<?> builder) { public StartupSection(Builder<?> builder) {
super(builder); super(builder);
this.items = (items != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.items) : Collections.<StartupSectionItem>emptyList(); this.items = (items != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.items) : Collections.<StartupSectionItem>emptyList();
this.any = (any != null) ? ImmutableList.<Object>copyOf(builder.any) : Collections.<Object>emptyList();
} }
/** /**
* Gets the value of the item property. * Gets the value of the item property.
*/ */
public List<StartupSectionItem> getItem() { public List<StartupSectionItem> getItems() {
return items; return items;
} }
/**
* Gets the value of the any property.
*/
public List<Object> getAny() {
return any;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -128,17 +109,16 @@ public class StartupSection extends SectionType {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
StartupSection that = StartupSection.class.cast(o); StartupSection that = StartupSection.class.cast(o);
return super.equals(that) && return super.equals(that) && equal(this.items, that.items);
equal(this.items, that.items) && equal(this.any, that.any);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), items, any); return Objects.hashCode(super.hashCode(), items);
} }
@Override @Override
public ToStringHelper string() { public ToStringHelper string() {
return super.string().add("items", items).add("any", any); return super.string().add("items", items);
} }
} }

View File

@ -1,23 +1,28 @@
// /*
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 * Licensed to jclouds, Inc. (jclouds) under one or more
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> * contributor license agreements. See the NOTICE file
// Any modifications to this file will be lost upon recompilation of the source schema. * distributed with this work for additional information
// Generated on: 2012.02.08 at 02:47:44 PM GMT * regarding copyright ownership. jclouds licenses this file
// * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** /**
* <p>Java class for Item element declaration. * Java class for Item element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* *
* <pre> * <pre>
* &lt;element name="Item"> * &lt;element name="Item">
@ -37,12 +42,23 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexType> * &lt;/complexType>
* &lt;/element> * &lt;/element>
* </pre> * </pre>
*
*
*/ */
@XmlType(name = "") @XmlType
@XmlRootElement(name = "Item") @XmlRootElement(name = "Item")
public class StartupSectionItem extends Item { public class StartupSectionItem extends Item {
// TODO Builder
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StartupSectionItem that = StartupSectionItem.class.cast(obj);
return super.equals(that);
}
} }

View File

@ -18,15 +18,21 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
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 java.util.Collections;
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.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData; import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
import com.google.common.base.Joiner;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -40,8 +46,10 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
* @author grkvlt@apache.org
*/ */
@XmlRootElement(name = "VirtualHardwareSection") @XmlRootElement(name = "VirtualHardwareSection")
@XmlType(name = "VirtualHardwareSection_Type")
public class VirtualHardwareSection extends SectionType { public class VirtualHardwareSection extends SectionType {
public static Builder<?> builder() { public static Builder<?> builder() {
@ -56,8 +64,9 @@ public class VirtualHardwareSection extends SectionType {
} }
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> { public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
protected VirtualSystemSettingData virtualSystem; protected VirtualSystemSettingData virtualSystem;
protected Set<String> transports = Sets.newLinkedHashSet(); protected String transport;
protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet(); protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
/** /**
@ -69,23 +78,31 @@ public class VirtualHardwareSection extends SectionType {
} }
/** /**
* @see VirtualHardwareSection#getTransports * @see VirtualHardwareSection#getTransport()
*/ */
public B transport(String transport) { public B transport(String transport) {
this.transports.add(checkNotNull(transport, "transport")); this.transport = transport;
return self(); return self();
} }
/** /**
* @see VirtualHardwareSection#getTransports * @see VirtualHardwareSection#getTransport()
*/ */
public B transports(Iterable<String> transports) { public B transport(Iterable<String> transports) {
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports")); this.transport = Joiner.on(',').join(transports);
return self(); return self();
} }
/** /**
* @see VirtualHardwareSection#getItems * @see VirtualHardwareSection#getTransport()
*/
public B transport(String...transports) {
this.transport = Joiner.on(',').join(transports);
return self();
}
/**
* @see VirtualHardwareSection#getItems()
*/ */
public B item(ResourceAllocationSettingData item) { public B item(ResourceAllocationSettingData item) {
this.items.add(checkNotNull(item, "item")); this.items.add(checkNotNull(item, "item"));
@ -93,11 +110,10 @@ public class VirtualHardwareSection extends SectionType {
} }
/** /**
* @see VirtualHardwareSection#getItems * @see VirtualHardwareSection#getItems()
*/ */
public B items(Iterable<? extends ResourceAllocationSettingData> items) { public B items(Iterable<? extends ResourceAllocationSettingData> items) {
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull( this.items = Sets.newLinkedHashSet(checkNotNull(items, "items"));
items, "items"));
return self(); return self();
} }
@ -110,20 +126,25 @@ public class VirtualHardwareSection extends SectionType {
} }
public B fromVirtualHardwareSection(VirtualHardwareSection in) { public B fromVirtualHardwareSection(VirtualHardwareSection in) {
return fromSectionType(in).items(in.getItems()).transports(in.getTransports()).system( return fromSectionType(in)
in.getSystem()).info(in.getInfo()); .items(in.getItems())
.transport(in.getTransport())
.system(in.getSystem());
} }
} }
@XmlElement(name = "System")
private VirtualSystemSettingData virtualSystem; private VirtualSystemSettingData virtualSystem;
private Set<String> transports; @XmlAttribute(name = "transport")
private Set<ResourceAllocationSettingData> items; private String transport;
@XmlElement(name = "Item")
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
private VirtualHardwareSection(Builder<?> builder) { private VirtualHardwareSection(Builder<?> builder) {
super(builder); super(builder);
this.virtualSystem = builder.virtualSystem; this.virtualSystem = builder.virtualSystem;
this.transports = ImmutableSet.<String>copyOf(checkNotNull(builder.transports, "transports")); this.transport = builder.transport;
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(builder.items, "items")); this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Collections.<ResourceAllocationSettingData>emptySet();
} }
private VirtualHardwareSection() { private VirtualHardwareSection() {
@ -131,9 +152,11 @@ public class VirtualHardwareSection extends SectionType {
} }
/** /**
* transport types define methods by which the environment document is communicated from the * Comma-separated list of supported transports types for the OVF descriptor.
*
* Transport types define methods by which the environment document is communicated from the
* deployment platform to the guest software. * deployment platform to the guest software.
* <p/> * <p>
* To enable interoperability, this specification defines an "iso" transport type which all * To enable interoperability, this specification defines an "iso" transport type which all
* implementations that support CD-ROM devices are required to support. The iso transport * implementations that support CD-ROM devices are required to support. The iso transport
* communicates the environment 1346 document by making a dynamically generated ISO image * communicates the environment 1346 document by making a dynamically generated ISO image
@ -141,14 +164,14 @@ public class VirtualHardwareSection extends SectionType {
* machine, an implementation shall make an ISO 9660 read-only disk image available as backing * machine, an implementation shall make an ISO 9660 read-only disk image available as backing
* for a disconnected CD-ROM. If the iso transport is selected for a VirtualHardwareSection, at * for a disconnected CD-ROM. If the iso transport is selected for a VirtualHardwareSection, at
* least one disconnected CD-ROM device shall be present in this section. * least one disconnected CD-ROM device shall be present in this section.
* <p/> * <p>
* Support for the "iso" transport type is not a requirement for virtual hardware architectures * Support for the "iso" transport type is not a requirement for virtual hardware architectures
* or guest 1351 operating systems which do not have CD-ROM device support. * or guest 1351 operating systems which do not have CD-ROM device support.
* *
* @return * @return
*/ */
public Set<String> getTransports() { public String getTransport() {
return transports; return transport;
} }
public VirtualSystemSettingData getSystem() { public VirtualSystemSettingData getSystem() {
@ -161,7 +184,7 @@ public class VirtualHardwareSection extends SectionType {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), transports, virtualSystem, items); return Objects.hashCode(super.hashCode(), transport, virtualSystem, items);
} }
@Override @Override
@ -169,15 +192,15 @@ public class VirtualHardwareSection 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;
VirtualHardwareSection that = VirtualHardwareSection.class.cast(obj);
VirtualHardwareSection other = (VirtualHardwareSection) obj; return super.equals(that) &&
return super.equals(other) && Objects.equal(transports, other.transports) equal(this.transport, that.transport) &&
&& Objects.equal(virtualSystem, other.virtualSystem) equal(this.virtualSystem, that.virtualSystem) &&
&& Objects.equal(items, other.items); equal(this.items, that.items);
} }
@Override @Override
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return super.string().add("transports", transports).add("virtualSystem", virtualSystem).add("items", items); return super.string().add("transport", transport).add("virtualSystem", virtualSystem).add("items", items);
} }
} }

View File

@ -19,14 +19,18 @@
@XmlSchema(namespace = VCLOUD_OVF_NS, @XmlSchema(namespace = VCLOUD_OVF_NS,
elementFormDefault = XmlNsForm.QUALIFIED, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS) @XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS),
@XmlNs(prefix = "vmv", namespaceURI = VCLOUD_VMW_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.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_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

@ -403,7 +403,7 @@ public interface VAppAsyncClient {
*/ */
@PUT @PUT
@Path("/networkConnectionSection") @Path("/networkConnectionSection")
@Produces(NETWORK_CONFIG_SECTION) @Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)

View File

@ -25,7 +25,7 @@ public class VCloudDirectorLiveTestConstants {
/* regular expressions for pattern matching */ /* regular expressions for pattern matching */
public static final String MAC_ADDRESS_PATTERN = "^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$"; public static final String MAC_ADDRESS_PATTERN = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$";
/* Error code 200 indicates success. */ /* Error code 200 indicates success. */

View File

@ -598,6 +598,25 @@ public class Checks {
return result; return result;
} }
public static void checkVmPendingQuestion(VmPendingQuestion question) {
// Check required fields
assertNotNull(question.getQuestion(), String.format(OBJ_FIELD_REQ, "VmPendingQuestion", "Question"));
assertNotNull(question.getQuestionId(), String.format(OBJ_FIELD_REQ, "VmPendingQuestion", "QuestionId"));
for (VmQuestionAnswerChoice choice : question.getChoices()) {
checkVmQuestionAnswerChoice(choice);
}
// Check parent type
checkResourceType(question);
}
public static void checkVmQuestionAnswerChoice(VmQuestionAnswerChoice choice) {
assertNotNull(choice, String.format(NOT_NULL_OBJ_FMT, "VmQuestionAnswerChoice"));
// NOTE the Id field cannot be checked
// NOTE the Text field cannot be checked
}
public static void checkVApp(VApp vApp) { public static void checkVApp(VApp vApp) {
// Check optional fields // Check optional fields
Owner owner = vApp.getOwner(); Owner owner = vApp.getOwner();
@ -727,11 +746,7 @@ public class Checks {
// Check optional fields // Check optional fields
VirtualSystemSettingData virtualSystem = hardware.getSystem(); VirtualSystemSettingData virtualSystem = hardware.getSystem();
if (virtualSystem != null) checkVirtualSystemSettingData(virtualSystem); if (virtualSystem != null) checkVirtualSystemSettingData(virtualSystem);
if (hardware.getTransports() != null) {
for (String transport : hardware.getTransports()) {
// NOTE transport cannot be checked // NOTE transport cannot be checked
}
}
if (hardware.getItems() != null) { if (hardware.getItems() != null) {
for (ResourceAllocationSettingData item : hardware.getItems()) { for (ResourceAllocationSettingData item : hardware.getItems()) {
checkResourceAllocationSettingData(item); checkResourceAllocationSettingData(item);

View File

@ -28,6 +28,7 @@ import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -44,8 +45,10 @@ import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.Vm; import org.jclouds.vcloud.director.v1_5.domain.Vm;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimBoolean;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimString; import org.jclouds.vcloud.director.v1_5.domain.cim.CimString;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedInt; import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedInt;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedLong;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD; import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates; import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
@ -223,12 +226,24 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
} }
} }
protected static CimBoolean cimBoolean(boolean val) {
CimBoolean result = new CimBoolean();
result.setValue(val);
return result;
}
protected static CimUnsignedInt cimUnsignedInt(long val) { protected static CimUnsignedInt cimUnsignedInt(long val) {
CimUnsignedInt result = new CimUnsignedInt(); CimUnsignedInt result = new CimUnsignedInt();
result.setValue(val); result.setValue(val);
return result; return result;
} }
protected static CimUnsignedLong cimUnsignedLong(BigInteger val) {
CimUnsignedLong result = new CimUnsignedLong();
result.setValue(val);
return result;
}
protected static CimString cimString(String value) { protected static CimString cimString(String value) {
return new CimString(value); return new CimString(value);
} }

View File

@ -44,14 +44,18 @@ import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkScreenTicket;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkStartupSection; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkStartupSection;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVApp; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVApp;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVmPendingQuestion;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
@ -67,6 +71,8 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection.IpAddressAllocationMode;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection; import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
@ -81,6 +87,9 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.cim.OSType;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData.ResourceType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.MsgType; import org.jclouds.vcloud.director.v1_5.domain.ovf.MsgType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
@ -93,6 +102,9 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -349,7 +361,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
assertFalse(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", vApp.isInMaintenanceMode())); assertFalse(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", vApp.isInMaintenanceMode()));
} }
@Test(testName = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testGetVApp" }) @Test(testName = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testPowerOnVApp" })
public void testInstallVMwareTools() { public void testInstallVMwareTools() {
// The method under test // The method under test
Task installVMwareTools = vAppClient.installVMwareTools(vApp.getHref()); Task installVMwareTools = vAppClient.installVMwareTools(vApp.getHref());
@ -416,6 +428,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vmURI); GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vmURI);
GuestCustomizationSection newSection = oldSection.toBuilder() GuestCustomizationSection newSection = oldSection.toBuilder()
.computerName("newComputerName") .computerName("newComputerName")
.enabled(Boolean.FALSE)
.adminPassword(null) // Not allowed .adminPassword(null) // Not allowed
.build(); .build();
@ -431,6 +444,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Check the modified section fields are set correctly // Check the modified section fields are set correctly
assertEquals(modified.getComputerName(), newSection.getComputerName()); assertEquals(modified.getComputerName(), newSection.getComputerName());
assertFalse(modified.isEnabled());
// Reset the admin password in the retrieved GuestCustomizationSection for equality check // Reset the admin password in the retrieved GuestCustomizationSection for equality check
modified = modified.toBuilder().adminPassword(null).build(); modified = modified.toBuilder().adminPassword(null).build();
@ -567,15 +581,23 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
}); });
} }
// FIXME "Task error: Unable to perform this action. Contact your cloud administrator."
@Test(testName = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" }) @Test(testName = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" })
public void testModifyNetworkConnectionSection() { public void testModifyNetworkConnectionSection() {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Look up a network in the Vdc
Set<Reference> networks = vdc.getAvailableNetworks().getNetworks();
Reference network = Iterables.getLast(networks);
// Copy existing section and update fields // Copy existing section and update fields
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vmURI); NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vmURI);
NetworkConnectionSection newSection = oldSection.toBuilder() NetworkConnectionSection newSection = oldSection.toBuilder()
.info("Changed NetworkConnectionSection Info") .networkConnection(NetworkConnection.builder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
.network(network.getName())
.build())
.build(); .build();
// The method under test // The method under test
@ -588,8 +610,8 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkNetworkConnectionSection(modified); checkNetworkConnectionSection(modified);
// Check the modified section fields are set correctly // Check the modified section has an extra network connection
assertEquals(modified.getInfo(), newSection.getInfo()); assertEquals(modified.getNetworkConnections().size(), newSection.getNetworkConnections().size() + 1);
// Check the section was modified correctly // Check the section was modified correctly
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConnectionSection")); assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConnectionSection"));
@ -621,13 +643,12 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Copy existing section and update fields // Create new OperatingSystemSection
OperatingSystemSection oldSection = vAppClient.getOperatingSystemSection(vmURI); OperatingSystemSection newSection = OperatingSystemSection.builder()
OperatingSystemSection newSection = oldSection.toBuilder() .info("") // NOTE Required OVF field, ignored
.info("Changed OperatingSystemSection Description") .id(OSType.RHEL_64.getCode())
.description("Changed OperatingSystemSection Description") .osType("rhel5_64Guest")
.build(); .build();
assertNotNull(newSection.getId());
// The method under test // The method under test
Task modifyOperatingSystemSection = vAppClient.modifyOperatingSystemSection(vmURI, newSection); Task modifyOperatingSystemSection = vAppClient.modifyOperatingSystemSection(vmURI, newSection);
@ -640,11 +661,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
checkOperatingSystemSection(modified); checkOperatingSystemSection(modified);
// Check the modified section fields are set correctly // Check the modified section fields are set correctly
assertEquals(modified.getInfo(), newSection.getInfo()); assertEquals(modified.getId(), newSection.getId());
assertEquals(modified.getDescription(), newSection.getDescription());
// Check the section was modified correctly
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "OperatingSystemSection"));
} }
@Test(testName = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" }) @Test(testName = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
@ -689,7 +706,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
ProductSectionList newSections = oldSections.toBuilder() ProductSectionList newSections = oldSections.toBuilder()
.productSection(ProductSection.builder() .productSection(ProductSection.builder()
.info("Information about the installed software") // Default ovf:Info text .info("Information about the installed software") // Default ovf:Info text
.required(true) .required()
.product(MsgType.builder().value("jclouds").build()) .product(MsgType.builder().value("jclouds").build())
.vendor(MsgType.builder().value("jclouds Inc.").build()) .vendor(MsgType.builder().value("jclouds Inc.").build())
// NOTE other ProductSection elements not returned by vCloud // NOTE other ProductSection elements not returned by vCloud
@ -706,21 +723,21 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkProductSectionList(modified); checkProductSectionList(modified);
// Check the modified section fields are set correctly // Check the modified object has an extra ProductSection
assertEquals(modified.getProductSections().size(), oldSections.getProductSections().size() + 1); assertEquals(modified.getProductSections().size(), oldSections.getProductSections().size() + 1);
// Check the section was modified correctly // Check the section was modified correctly
assertEquals(modified, newSections, String.format(ENTITY_EQUAL, "ProductSectionList")); assertEquals(modified, newSections, String.format(ENTITY_EQUAL, "ProductSectionList"));
} }
@Test(testName = "GET /vApp/{id}/question", dependsOnMethods = { "testGetVApp" }) @Test(testName = "GET /vApp/{id}/question", dependsOnMethods = { "testPowerOnVApp" })
public void testGetPendingQuestion() { public void testGetPendingQuestion() {
// TODO how to test? // TODO how to test?
// The method under test // The method under test
VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref()); VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
// checkQuestion(question); checkVmPendingQuestion(question);
} }
@Test(testName = "PUT /vApp/{id}/question/action/answer", dependsOnMethods = { "testGetPendingQuestion" }) @Test(testName = "PUT /vApp/{id}/question/action/answer", dependsOnMethods = { "testGetPendingQuestion" })
@ -818,7 +835,24 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Copy existing section and update fields // Copy existing section and update fields
VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vmURI); VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vmURI);
VirtualHardwareSection newSection = oldSection.toBuilder().build(); Optional<? extends ResourceAllocationSettingData> memory = Iterables.tryFind(oldSection.getItems(),
new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(ResourceAllocationSettingData item) {
return item.getResourceType() == ResourceType.MEMORY;
}
});
if (memory.isPresent()) debug(memory);
VirtualHardwareSection newSection = oldSection.toBuilder()
.item(ResourceAllocationSettingData.builder()
.elementName(cimString("Memory"))
.instanceID(cimString(UUID.randomUUID().toString()))
.allocationUnits(cimString("byte * 2^20"))
.reservation(cimUnsignedLong(BigInteger.valueOf(0L)))
.virtualQuantity(cimUnsignedLong(BigInteger.valueOf(1024L)))
.weight(cimUnsignedInt(0L))
.build())
.build();
// The method under test // The method under test
Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vmURI, newSection); Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vmURI, newSection);
@ -840,7 +874,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI); RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
// Check the retrieved object is well formed
checkRASD(rasd); checkRASD(rasd);
} }
@ -878,6 +915,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vmURI); RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -928,6 +966,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vmURI); RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -939,6 +978,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI); RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -973,6 +1013,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vmURI); RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -1007,6 +1048,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM // Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref(); URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vmURI); RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ERROR;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION;
@ -390,7 +391,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(METADATA).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(), new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
@ -411,7 +412,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(METADATA).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
client.getVAppTemplateMetadata(uri); client.getVAppTemplateMetadata(uri);