fixed builders on vcloud classes

This commit is contained in:
Adrian Cole 2011-05-25 00:31:02 -06:00
parent 963fffce82
commit 9f1f61d3b4
12 changed files with 378 additions and 207 deletions

View File

@ -33,6 +33,14 @@ public class EditableResourceAllocationSettingData extends ResourceAllocationSet
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromEditableResourceAllocationSettingData(this);
}
public static class Builder extends ResourceAllocationSettingData.Builder { public static class Builder extends ResourceAllocationSettingData.Builder {
private ReferenceType edit; private ReferenceType edit;
@ -46,9 +54,9 @@ public class EditableResourceAllocationSettingData extends ResourceAllocationSet
public EditableResourceAllocationSettingData build() { public EditableResourceAllocationSettingData build() {
return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address, return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address,
addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
resourceType, virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit); virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit);
} }
public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) { public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) {
@ -266,16 +274,15 @@ public class EditableResourceAllocationSettingData extends ResourceAllocationSet
public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption, public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption,
String description, String address, String addressOnParent, String allocationUnits, String description, String address, String addressOnParent, String allocationUnits,
Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
Long limit, MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
Long reservation, String resourceSubType, String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType,
org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity, Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections,
String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources, List<String> hostResources, ReferenceType edit) {
ReferenceType edit) {
super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
virtualQuantityUnits, weight, connections, hostResources); connections, hostResources);
this.edit = edit; this.edit = edit;
} }
@ -283,20 +290,15 @@ public class EditableResourceAllocationSettingData extends ResourceAllocationSet
return edit; return edit;
} }
@Override
public Builder toBuilder() {
return new Builder().fromEditableResourceAllocationSettingData(this);
}
@Override @Override
public String toString() { public String toString() {
return String return String
.format( .format(
"[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, edit=%s]", "[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, edit=%s]",
elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
resourceType, virtualQuantity, virtualQuantityUnits, weight, edit); virtualQuantity, virtualQuantityUnits, weight, edit);
} }
} }

View File

@ -32,6 +32,14 @@ public class VCloudHardDisk extends ResourceAllocationSettingData {
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVCloudHardDisk(this);
}
public static class Builder extends ResourceAllocationSettingData.Builder { public static class Builder extends ResourceAllocationSettingData.Builder {
private long capacity; private long capacity;
private int busType; private int busType;
@ -63,10 +71,9 @@ public class VCloudHardDisk extends ResourceAllocationSettingData {
public VCloudHardDisk build() { public VCloudHardDisk build() {
return new VCloudHardDisk(elementName, instanceID, caption, description, address, addressOnParent, return new VCloudHardDisk(elementName, instanceID, caption, description, address, addressOnParent,
allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior,
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity,
virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, capacity, busType, virtualQuantityUnits, weight, connections, hostResources, capacity, busType, busSubType);
busSubType);
} }
public Builder fromVCloudHardDisk(VCloudHardDisk in) { public Builder fromVCloudHardDisk(VCloudHardDisk in) {
@ -286,15 +293,15 @@ public class VCloudHardDisk extends ResourceAllocationSettingData {
public VCloudHardDisk(String elementName, String instanceID, String caption, String description, String address, public VCloudHardDisk(String elementName, String instanceID, String caption, String description, String address,
String addressOnParent, String allocationUnits, Boolean automaticAllocation, Boolean automaticDeallocation, String addressOnParent, String allocationUnits, Boolean automaticAllocation, Boolean automaticDeallocation,
ConsumerVisibility consumerVisibility, Long limit, MappingBehavior mappingBehavior, ConsumerVisibility consumerVisibility, Long limit, MappingBehavior mappingBehavior, String otherResourceType,
String otherResourceType, String parent, String poolID, Long reservation, String resourceSubType, String parent, String poolID, Long reservation, String resourceSubType,
org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity,
String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources, String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources,
long capacity, int busType, String busSubType) { long capacity, int busType, String busSubType) {
super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
virtualQuantityUnits, weight, connections, hostResources); connections, hostResources);
this.capacity = capacity; this.capacity = capacity;
this.busType = busType; this.busType = busType;
this.busSubType = busSubType; this.busSubType = busSubType;
@ -312,19 +319,14 @@ public class VCloudHardDisk extends ResourceAllocationSettingData {
return busSubType; return busSubType;
} }
@Override
public Builder toBuilder() {
return builder().fromVCloudHardDisk(this);
}
@Override @Override
public String toString() { public String toString() {
return String return String
.format( .format(
"[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, busSubType=%s, busType=%s, capacity=%s]", "[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, busSubType=%s, busType=%s, capacity=%s]",
elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
resourceType, virtualQuantity, virtualQuantityUnits, weight, busSubType, busType, capacity); virtualQuantity, virtualQuantityUnits, weight, busSubType, busType, capacity);
} }
} }

View File

@ -32,6 +32,14 @@ public class VCloudNetworkAdapter extends ResourceAllocationSettingData {
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVCloudNetworkAdapter(this);
}
public static class Builder extends ResourceAllocationSettingData.Builder { public static class Builder extends ResourceAllocationSettingData.Builder {
private String ipAddress; private String ipAddress;
private boolean primaryNetworkConnection; private boolean primaryNetworkConnection;
@ -312,11 +320,6 @@ public class VCloudNetworkAdapter extends ResourceAllocationSettingData {
return ipAddressingMode; return ipAddressingMode;
} }
@Override
public Builder toBuilder() {
return builder().fromVCloudNetworkAdapter(this);
}
@Override @Override
public String toString() { public String toString() {
return String return String

View File

@ -22,18 +22,127 @@ import java.net.URI;
import org.jclouds.cim.ResourceAllocationSettingData; import org.jclouds.cim.ResourceAllocationSettingData;
import org.jclouds.cim.VirtualSystemSettingData; import org.jclouds.cim.VirtualSystemSettingData;
import org.jclouds.ovf.Section;
import org.jclouds.ovf.VirtualHardwareSection; import org.jclouds.ovf.VirtualHardwareSection;
/** /**
* A description of the virtual hardware supported by a virtual machine. * A description of the virtual hardware supported by a virtual machine.
*/ */
public class VCloudVirtualHardwareSection extends VirtualHardwareSection { public class VCloudVirtualHardwareSection extends VirtualHardwareSection {
public static Builder builder() {
return new Builder();
}
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVCloudVirtualHardwareSection(this);
}
public static class Builder extends VirtualHardwareSection.Builder {
protected String type;
protected URI href;
/**
* @see VCloudVirtualHardware#getType
*/
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see VCloudVirtualHardware#getHref
*/
public Builder href(URI href) {
this.href = href;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public Builder system(VirtualSystemSettingData virtualSystem) {
return Builder.class.cast(super.system(virtualSystem));
}
/**
* {@inheritDoc}
*/
@Override
public Builder transport(String transport) {
return Builder.class.cast(super.transport(transport));
}
/**
* {@inheritDoc}
*/
@Override
public Builder transports(Iterable<String> transports) {
return Builder.class.cast(super.transports(transports));
}
/**
* {@inheritDoc}
*/
@Override
public Builder item(ResourceAllocationSettingData item) {
return Builder.class.cast(super.item(item));
}
/**
* {@inheritDoc}
*/
@Override
public Builder items(Iterable<? extends ResourceAllocationSettingData> items) {
return Builder.class.cast(super.items(items));
}
/**
* {@inheritDoc}
*/
@Override
public VCloudVirtualHardwareSection build() {
return new VCloudVirtualHardwareSection(type, href, info, transports, virtualSystem, items);
}
public Builder fromVCloudVirtualHardwareSection(VCloudVirtualHardwareSection in) {
return fromVirtualHardwareSection(in).type(in.getType()).href(in.getHref());
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
return Builder.class.cast(super.fromVirtualHardwareSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromSection(Section<VirtualHardwareSection> in) {
return Builder.class.cast(super.fromSection(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder info(String info) {
return Builder.class.cast(super.info(info));
}
}
protected final String type; protected final String type;
protected final URI href; protected final URI href;
public VCloudVirtualHardwareSection(String type, URI href, String info, Iterable<String> transports, public VCloudVirtualHardwareSection(String type, URI href, String info, Iterable<String> transports,
VirtualSystemSettingData virtualSystem, VirtualSystemSettingData virtualSystem, Iterable<? extends ResourceAllocationSettingData> resourceAllocations) {
Iterable<? extends ResourceAllocationSettingData> resourceAllocations) {
super(info, transports, virtualSystem, resourceAllocations); super(info, transports, virtualSystem, resourceAllocations);
this.type = type; this.type = type;
this.href = href; this.href = href;

View File

@ -36,7 +36,7 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClient, VCloudAsyncClient> { public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClient, VCloudAsyncClient> {
@Test @Test

View File

@ -193,7 +193,6 @@ public interface VCloudMediaType {
*/ */
public final static MediaType VAPPTEMPLATE_XML_TYPE = new MediaType("application", public final static MediaType VAPPTEMPLATE_XML_TYPE = new MediaType("application",
"vnd.vmware.vcloud.vAppTemplate+xml"); "vnd.vmware.vcloud.vAppTemplate+xml");
/** /**
* "application/vnd.vmware.vcloud.network+xml" * "application/vnd.vmware.vcloud.network+xml"
*/ */

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cim; package org.jclouds.cim;
/** /**
* *
* ManagedElement is an abstract class that provides a common superclass (or top of the inheritance * ManagedElement is an abstract class that provides a common superclass (or top of the inheritance
@ -30,6 +31,17 @@ package org.jclouds.cim;
* *
*/ */
public abstract class ManagedElement extends SettingData { 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 { public static class Builder extends SettingData.Builder {
protected String caption; protected String caption;

View File

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

View File

@ -36,6 +36,10 @@ public abstract class SettingData implements Comparable<SettingData> {
return new Builder(); return new Builder();
} }
public Builder toBuilder() {
return builder().fromSettingData(this);
}
public static class Builder { public static class Builder {
protected String elementName; protected String elementName;
protected String instanceID; protected String instanceID;

View File

@ -55,6 +55,14 @@ public class VirtualSystemSettingData extends ManagedElement {
return new Builder(); return new Builder();
} }
/**
* {@inheritDoc}
*/
@Override
public Builder toBuilder() {
return builder().fromVirtualSystemSettingData(this);
}
public static class Builder extends ManagedElement.Builder { public static class Builder extends ManagedElement.Builder {
private AutomaticRecoveryAction automaticRecoveryAction; private AutomaticRecoveryAction automaticRecoveryAction;
private AutomaticShutdownAction automaticShutdownAction; private AutomaticShutdownAction automaticShutdownAction;
@ -530,10 +538,6 @@ public class VirtualSystemSettingData extends ManagedElement {
return notes; return notes;
} }
public Builder toBuilder() {
return builder().fromVirtualSystemSettingData(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;

View File

@ -107,7 +107,7 @@ public class VirtualHardwareSection extends Section<VirtualHardwareSection> {
} }
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) { public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
return items(in.getItems()).transports(in.getTransports()).system( return fromSection(in).items(in.getItems()).transports(in.getTransports()).system(
in.getSystem()).info(in.getInfo()); in.getSystem()).info(in.getInfo());
} }

View File

@ -26,7 +26,7 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest { public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest {
public BlueLockVCloudDirectorClientLiveTest() { public BlueLockVCloudDirectorClientLiveTest() {
provider = "bluelock-vcdirector"; provider = "bluelock-vcdirector";