mirror of https://github.com/apache/jclouds.git
VCloud Director 1.5: removing duplicate files
This commit is contained in:
parent
2842ad82a1
commit
dd68cbf73a
|
@ -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.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,242 +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.cim;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Operating system based on DMTF CIM model.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @see <a
|
|
||||||
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
public enum OSType {
|
|
||||||
/**
|
|
||||||
* Other
|
|
||||||
*/
|
|
||||||
OTHER(1, "Other", OsFamily.UNRECOGNIZED, false),
|
|
||||||
/**
|
|
||||||
* MACOS
|
|
||||||
*/
|
|
||||||
MACOS(2, "MACOS", OsFamily.DARWIN, false),
|
|
||||||
/**
|
|
||||||
* Solaris
|
|
||||||
*/
|
|
||||||
SOLARIS(29, "Solaris", OsFamily.SOLARIS, false),
|
|
||||||
/**
|
|
||||||
* LINUX
|
|
||||||
*/
|
|
||||||
LINUX(36, "LINUX", OsFamily.LINUX, false),
|
|
||||||
/**
|
|
||||||
* FreeBSD
|
|
||||||
*/
|
|
||||||
FREEBSD(42, "FreeBSD", OsFamily.FREEBSD, false),
|
|
||||||
/**
|
|
||||||
* NetBSD
|
|
||||||
*/
|
|
||||||
NETBSD(43, "NetBSD", OsFamily.NETBSD, false),
|
|
||||||
/**
|
|
||||||
* OpenBSD
|
|
||||||
*/
|
|
||||||
OPENBSD(65, "OpenBSD", OsFamily.OPENBSD, false),
|
|
||||||
/**
|
|
||||||
* Not Applicable
|
|
||||||
*/
|
|
||||||
NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows Server 2003
|
|
||||||
*/
|
|
||||||
WINDOWS_SERVER_2003(69, "Microsoft Windows Server 2003", OsFamily.WINDOWS, false),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows Server 2003 64-Bit
|
|
||||||
*/
|
|
||||||
WINDOWS_SERVER_2003_64(70, "Microsoft Windows Server 2003 64-Bit", OsFamily.WINDOWS, true),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows Server 2008
|
|
||||||
*/
|
|
||||||
WINDOWS_SERVER_2008(76, "Microsoft Windows Server 2008", OsFamily.WINDOWS, false),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows Server 2008 64-Bit
|
|
||||||
*/
|
|
||||||
WINDOWS_SERVER_2008_64(77, "Microsoft Windows Server 2008 64-Bit", OsFamily.WINDOWS, true),
|
|
||||||
/**
|
|
||||||
* FreeBSD 64-Bit
|
|
||||||
*/
|
|
||||||
FREEBSD_64(78, "FreeBSD 64-Bit", OsFamily.FREEBSD, true),
|
|
||||||
/**
|
|
||||||
* RedHat Enterprise Linux
|
|
||||||
*/
|
|
||||||
RHEL(79, "RedHat Enterprise Linux", OsFamily.RHEL, false),
|
|
||||||
/**
|
|
||||||
* RedHat Enterprise Linux 64-Bit
|
|
||||||
*/
|
|
||||||
RHEL_64(80, "RedHat Enterprise Linux 64-Bit", OsFamily.RHEL, true),
|
|
||||||
/**
|
|
||||||
* Solaris 64-Bit
|
|
||||||
*/
|
|
||||||
SOLARIS_64(81, "Solaris 64-Bit", OsFamily.SOLARIS, true),
|
|
||||||
/**
|
|
||||||
* SUSE
|
|
||||||
*/
|
|
||||||
SUSE(82, "SUSE", OsFamily.SUSE, false),
|
|
||||||
/**
|
|
||||||
* SUSE 64-Bit
|
|
||||||
*/
|
|
||||||
SUSE_64(83, "SUSE 64-Bit", OsFamily.SUSE, true),
|
|
||||||
/**
|
|
||||||
* SLES
|
|
||||||
*/
|
|
||||||
SLES(84, "SLES", OsFamily.SUSE, false),
|
|
||||||
/**
|
|
||||||
* SLES 64-Bit
|
|
||||||
*/
|
|
||||||
SLES_64(85, "SLES 64-Bit", OsFamily.SUSE, true),
|
|
||||||
/**
|
|
||||||
* Novell OES
|
|
||||||
*/
|
|
||||||
NOVELL_OES(86, "Novell OES", OsFamily.SUSE, true),
|
|
||||||
/**
|
|
||||||
* Mandriva
|
|
||||||
*/
|
|
||||||
MANDRIVA(89, "Mandriva", OsFamily.MANDRIVA, false),
|
|
||||||
/**
|
|
||||||
* Mandriva 64-Bit
|
|
||||||
*/
|
|
||||||
MANDRIVA_64(90, "Mandriva 64-Bit", OsFamily.MANDRIVA, true),
|
|
||||||
/**
|
|
||||||
* TurboLinux
|
|
||||||
*/
|
|
||||||
TURBOLINUX(91, "TurboLinux", OsFamily.TURBOLINUX, false),
|
|
||||||
/**
|
|
||||||
* TurboLinux 64-Bit
|
|
||||||
*/
|
|
||||||
TURBOLINUX_64(92, "TurboLinux 64-Bit", OsFamily.TURBOLINUX, true),
|
|
||||||
/**
|
|
||||||
* Ubuntu
|
|
||||||
*/
|
|
||||||
UBUNTU(93, "Ubuntu", OsFamily.UBUNTU, false),
|
|
||||||
/**
|
|
||||||
* Ubuntu 64-Bit
|
|
||||||
*/
|
|
||||||
UBUNTU_64(94, "Ubuntu 64-Bit", OsFamily.UBUNTU, true),
|
|
||||||
/**
|
|
||||||
* Debian
|
|
||||||
*/
|
|
||||||
DEBIAN(95, "Debian", OsFamily.DEBIAN, false),
|
|
||||||
/**
|
|
||||||
* Debian 64-Bit
|
|
||||||
*/
|
|
||||||
DEBIAN_64(96, "Debian 64-Bit", OsFamily.DEBIAN, false),
|
|
||||||
/**
|
|
||||||
* Linux 2.4.x
|
|
||||||
*/
|
|
||||||
LINUX_2_4(97, "Linux 2.4.x", OsFamily.LINUX, false),
|
|
||||||
/**
|
|
||||||
* Linux 2.4.x 64-Bi
|
|
||||||
*/
|
|
||||||
LINUX_2_4_64(98, "Linux 2.4.x 64-Bit", OsFamily.LINUX, true),
|
|
||||||
/**
|
|
||||||
* Linux 2.6.x
|
|
||||||
*/
|
|
||||||
LINUX_2_6(99, "Linux 2.6.x", OsFamily.LINUX, false),
|
|
||||||
/**
|
|
||||||
* Linux 2.6.x 64-Bit
|
|
||||||
*/
|
|
||||||
LINUX_2_6_64(100, "Linux 2.6.x 64-Bit", OsFamily.LINUX, true),
|
|
||||||
/**
|
|
||||||
* Linux 64-Bit
|
|
||||||
*/
|
|
||||||
LINUX_64(101, "Linux 64-Bit", OsFamily.LINUX, true),
|
|
||||||
/**
|
|
||||||
* Other 64-Bit
|
|
||||||
*/
|
|
||||||
OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows Server 2008 R2
|
|
||||||
*/
|
|
||||||
WINDOWS_SERVER_2008_R2(103, "Microsoft Windows Server 2008 R2", OsFamily.WINDOWS, true),
|
|
||||||
/**
|
|
||||||
* VMware ESXi
|
|
||||||
*/
|
|
||||||
ESXI(104, "VMware ESXi", OsFamily.ESX, true),
|
|
||||||
/**
|
|
||||||
* Microsoft Windows 7
|
|
||||||
*/
|
|
||||||
WINDOWS_7(105, "Microsoft Windows 7", OsFamily.WINDOWS, false),
|
|
||||||
/**
|
|
||||||
* CentOS 32-bit
|
|
||||||
*/
|
|
||||||
CENTOS(106, "CentOS 32-bit", OsFamily.CENTOS, false),
|
|
||||||
/**
|
|
||||||
* CentOS 64-bit
|
|
||||||
*/
|
|
||||||
CENTOS_64(107, "CentOS 64-bit", OsFamily.CENTOS, true),
|
|
||||||
/**
|
|
||||||
* Oracle Enterprise Linux 32-bit
|
|
||||||
*/
|
|
||||||
ORACLE_ENTERPRISE_LINUX(108, "Oracle Enterprise Linux 32-bit", OsFamily.OEL, false),
|
|
||||||
/**
|
|
||||||
* Oracle Enterprise Linux 64-bit
|
|
||||||
*/
|
|
||||||
ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true),
|
|
||||||
/**
|
|
||||||
* eComStation 32-bitx
|
|
||||||
*/
|
|
||||||
ECOMSTATION_32(109, "eComStation 32-bitx", OsFamily.UNRECOGNIZED, false), UNRECOGNIZED(Integer.MAX_VALUE,
|
|
||||||
"UNRECOGNIZED", null, true);
|
|
||||||
private final int code;
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsFamily getFamily() {
|
|
||||||
return family;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean is64Bit() {
|
|
||||||
return is64Bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
private final OsFamily family;
|
|
||||||
private final boolean is64Bit;
|
|
||||||
|
|
||||||
OSType(int code, String value, OsFamily family, boolean is64Bit) {
|
|
||||||
this.code = code;
|
|
||||||
this.value = value;
|
|
||||||
this.family = family;
|
|
||||||
this.is64Bit = is64Bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OSType fromValue(int code) {
|
|
||||||
for (OSType type : values()) {
|
|
||||||
if (type.code == code)
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
return UNRECOGNIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,747 +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.cim;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* The ResourceAllocationSettingData class represents settings specifically
|
|
||||||
* related to an allocated resource that are outside the scope of the CIM class
|
|
||||||
* typically used to represent the resource itself. These settings include
|
|
||||||
* information specific to the allocation that may not be visible to the
|
|
||||||
* consumer of the resource itself. For example, a virtual processor may look
|
|
||||||
* 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
|
|
||||||
* @see <a href=
|
|
||||||
* "http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
|
|
||||||
* />
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ResourceAllocationSettingData extends ManagedElement {
|
|
||||||
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromResourceAllocationSettingData(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends ManagedElement.Builder {
|
|
||||||
|
|
||||||
protected String address;
|
|
||||||
protected String addressOnParent;
|
|
||||||
protected String allocationUnits;
|
|
||||||
protected Boolean automaticAllocation;
|
|
||||||
protected Boolean automaticDeallocation;
|
|
||||||
protected ConsumerVisibility consumerVisibility;
|
|
||||||
protected Long limit;
|
|
||||||
protected MappingBehavior mappingBehavior;
|
|
||||||
protected String otherResourceType;
|
|
||||||
protected String parent;
|
|
||||||
protected String poolID;
|
|
||||||
protected Long reservation;
|
|
||||||
protected String resourceSubType;
|
|
||||||
protected ResourceType resourceType;
|
|
||||||
protected Long virtualQuantity;
|
|
||||||
protected String virtualQuantityUnits;
|
|
||||||
protected Integer weight;
|
|
||||||
protected List<String> connections = Lists.newArrayList();
|
|
||||||
protected List<String> hostResources = Lists.newArrayList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getAddress
|
|
||||||
*/
|
|
||||||
public Builder address(String address) {
|
|
||||||
this.address = address;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getAddressOnParent
|
|
||||||
*/
|
|
||||||
public Builder addressOnParent(String addressOnParent) {
|
|
||||||
this.addressOnParent = addressOnParent;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getAllocationUnits
|
|
||||||
*/
|
|
||||||
public Builder allocationUnits(String allocationUnits) {
|
|
||||||
this.allocationUnits = allocationUnits;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#isAutomaticAllocation()
|
|
||||||
*/
|
|
||||||
public Builder automaticAllocation(Boolean automaticAllocation) {
|
|
||||||
this.automaticAllocation = automaticAllocation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#isAutomaticDeallocation()
|
|
||||||
*/
|
|
||||||
public Builder automaticDeallocation(Boolean automaticDeallocation) {
|
|
||||||
this.automaticDeallocation = automaticDeallocation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getConsumerVisibility
|
|
||||||
*/
|
|
||||||
public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
|
|
||||||
this.consumerVisibility = consumerVisibility;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getLimit
|
|
||||||
*/
|
|
||||||
public Builder limit(Long limit) {
|
|
||||||
this.limit = limit;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getMappingBehavior
|
|
||||||
*/
|
|
||||||
public Builder mappingBehavior(MappingBehavior mappingBehavior) {
|
|
||||||
this.mappingBehavior = mappingBehavior;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getOtherResourceType
|
|
||||||
*/
|
|
||||||
public Builder otherResourceType(String otherResourceType) {
|
|
||||||
this.otherResourceType = otherResourceType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getParent
|
|
||||||
*/
|
|
||||||
public Builder parent(String parent) {
|
|
||||||
this.parent = parent;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getPoolID
|
|
||||||
*/
|
|
||||||
public Builder poolID(String poolID) {
|
|
||||||
this.poolID = poolID;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getReservation
|
|
||||||
*/
|
|
||||||
public Builder reservation(Long reservation) {
|
|
||||||
this.reservation = reservation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getResourceSubType
|
|
||||||
*/
|
|
||||||
public Builder resourceSubType(String resourceSubType) {
|
|
||||||
this.resourceSubType = resourceSubType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getResourceType
|
|
||||||
*/
|
|
||||||
public Builder resourceType(ResourceType resourceType) {
|
|
||||||
this.resourceType = resourceType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getVirtualQuantity
|
|
||||||
*/
|
|
||||||
public Builder virtualQuantity(Long virtualQuantity) {
|
|
||||||
this.virtualQuantity = virtualQuantity;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getVirtualQuantityUnits
|
|
||||||
*/
|
|
||||||
public Builder virtualQuantityUnits(String virtualQuantityUnits) {
|
|
||||||
this.virtualQuantityUnits = virtualQuantityUnits;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getWeight
|
|
||||||
*/
|
|
||||||
public Builder weight(Integer weight) {
|
|
||||||
this.weight = weight;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getConnections()
|
|
||||||
*/
|
|
||||||
public Builder connection(String connection) {
|
|
||||||
this.connections.add(checkNotNull(connection, "connection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getHostResources()
|
|
||||||
*/
|
|
||||||
public Builder hostResource(String hostResource) {
|
|
||||||
this.hostResources.add(checkNotNull(hostResource, "hostResource"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getConnections
|
|
||||||
*/
|
|
||||||
public Builder connections(List<String> connections) {
|
|
||||||
this.connections.addAll(checkNotNull(connections, "connections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ResourceAllocationSettingData#getHostResources
|
|
||||||
*/
|
|
||||||
public Builder hostResources(List<String> hostResources) {
|
|
||||||
this.hostResources.addAll(checkNotNull(hostResources, "hostResources"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceAllocationSettingData build() {
|
|
||||||
return new ResourceAllocationSettingData(elementName, instanceID, caption, description, address,
|
|
||||||
addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
|
|
||||||
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
|
|
||||||
virtualQuantity, virtualQuantityUnits, weight, connections, hostResources);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
|
|
||||||
return fromManagedElement(in).address(in.getAddress()).addressOnParent(in.getAddressOnParent())
|
|
||||||
.allocationUnits(in.getAllocationUnits()).automaticAllocation(in.isAutomaticAllocation())
|
|
||||||
.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());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@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.
|
|
||||||
*/
|
|
||||||
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(
|
|
||||||
8), IB_HCA(9), ETHERNET_ADAPTER(10), OTHER_NETWORK_ADAPTER(11), IO_SLOT(12), IO_DEVICE(13), FLOPPY_DRIVE(14), CD_DRIVE(
|
|
||||||
15), DVD_DRIVE(16), DISK_DRIVE(17), TAPE_DRIVE(18), STORAGE_EXTENT(19), OTHER_STORAGE_DEVICE(20), SERIAL_PORT(
|
|
||||||
21), PARALLEL_PORT(22), USB_CONTROLLER(23), GRAPHICS_CONTROLLER(24), IEEE_1394_CONTROLLER(25), PARTITIONABLE_UNIT(
|
|
||||||
26), BASE_PARTITIONABLE_UNIT(27), POWER(28), COOLING_CAPACITY(29), ETHERNET_SWITCH_PORT(30), LOGICAL_DISK(
|
|
||||||
31), STORAGE_VOLUME(32), ETHERNET_CONNECTION(33), DMTF_RESERVED(Integer.valueOf("8000", 16)), VENDOR_RESERVED(
|
|
||||||
Integer.valueOf("FFFF", 16));
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
ResourceType(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, ResourceType> RESOURCE_TYPE_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(ResourceType.values()), new Function<ResourceType, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(ResourceType input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static ResourceType fromValue(String type) {
|
|
||||||
return RESOURCE_TYPE_BY_ID.get(new Integer(checkNotNull(type, "type")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Describes the consumers visibility to the allocated resource.
|
|
||||||
*/
|
|
||||||
public static enum ConsumerVisibility {
|
|
||||||
UNKNOWN(0),
|
|
||||||
/**
|
|
||||||
* indicates the underlying or host resource is utilized and passed
|
|
||||||
* through to the consumer, possibly using partitioning. At least one item
|
|
||||||
* shall be present in the HostResource property.
|
|
||||||
*/
|
|
||||||
PASSED_THROUGH(2),
|
|
||||||
/**
|
|
||||||
* indicates the resource is virtualized and may not map directly to an
|
|
||||||
* underlying/host resource. Some implementations may support specific
|
|
||||||
* assignment for virtualized resources, in which case the host
|
|
||||||
* resource(s) are exposed using the HostResource property.
|
|
||||||
*/
|
|
||||||
VIRTUALIZED(3),
|
|
||||||
/**
|
|
||||||
* indicates a representation of the resource does not exist within the
|
|
||||||
* context of the resource consumer.
|
|
||||||
*/
|
|
||||||
NOT_REPRESENTED(4), DMTF_RESERVED(32767), VENDOR_RESERVED(65535);
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
ConsumerVisibility(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, ConsumerVisibility> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(ConsumerVisibility.values()), new Function<ConsumerVisibility, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(ConsumerVisibility input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static ConsumerVisibility fromValue(String behavior) {
|
|
||||||
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies how this resource maps to underlying resourcesIf the
|
|
||||||
* HostResource array contains any entries, this property reflects how the
|
|
||||||
* resource maps to those specific resources.
|
|
||||||
*/
|
|
||||||
public static enum MappingBehavior {
|
|
||||||
UNKNOWN(0), NOT_SUPPORTED(2), DEDICATED(3), SOFT_AFFINITY(4), HARD_AFFINITY(5), DMTF_RESERVED(32767), VENDOR_RESERVED(
|
|
||||||
65535);
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
MappingBehavior(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, MappingBehavior> MAPPING_BEHAVIOR_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(MappingBehavior.values()), new Function<MappingBehavior, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(MappingBehavior input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static MappingBehavior fromValue(String behavior) {
|
|
||||||
return MAPPING_BEHAVIOR_BY_ID.get(new Integer(checkNotNull(behavior, "behavior")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String address;
|
|
||||||
protected String addressOnParent;
|
|
||||||
protected String allocationUnits;
|
|
||||||
protected Boolean automaticAllocation;
|
|
||||||
protected Boolean automaticDeallocation;
|
|
||||||
protected ConsumerVisibility consumerVisibility;
|
|
||||||
protected Long limit;
|
|
||||||
protected MappingBehavior mappingBehavior;
|
|
||||||
protected String otherResourceType;
|
|
||||||
protected String parent;
|
|
||||||
protected String poolID;
|
|
||||||
protected Long reservation;
|
|
||||||
protected String resourceSubType;
|
|
||||||
protected ResourceType resourceType;
|
|
||||||
protected Long virtualQuantity;
|
|
||||||
protected String virtualQuantityUnits;
|
|
||||||
protected Integer weight;
|
|
||||||
protected List<String> connections;
|
|
||||||
protected List<String> hostResources;
|
|
||||||
|
|
||||||
private ResourceAllocationSettingData(String elementName, String instanceID, String caption, String description,
|
|
||||||
String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation,
|
|
||||||
Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
|
|
||||||
MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
|
|
||||||
String resourceSubType, ResourceType resourceType, Long virtualQuantity, String virtualQuantityUnits,
|
|
||||||
Integer weight, List<String> connections, List<String> hostResources) {
|
|
||||||
super(elementName, instanceID, caption, description);
|
|
||||||
this.address = address;
|
|
||||||
this.addressOnParent = addressOnParent;
|
|
||||||
this.allocationUnits = allocationUnits;
|
|
||||||
this.automaticAllocation = automaticAllocation;
|
|
||||||
this.automaticDeallocation = automaticDeallocation;
|
|
||||||
this.consumerVisibility = consumerVisibility;
|
|
||||||
this.limit = limit;
|
|
||||||
this.mappingBehavior = mappingBehavior;
|
|
||||||
this.otherResourceType = otherResourceType;
|
|
||||||
this.parent = parent;
|
|
||||||
this.poolID = poolID;
|
|
||||||
this.reservation = reservation;
|
|
||||||
this.resourceSubType = resourceSubType;
|
|
||||||
this.resourceType = resourceType;
|
|
||||||
this.virtualQuantity = virtualQuantity;
|
|
||||||
this.virtualQuantityUnits = virtualQuantityUnits;
|
|
||||||
this.weight = weight;
|
|
||||||
this.connections = ImmutableList.copyOf(connections);
|
|
||||||
this.hostResources = ImmutableList.copyOf(hostResources);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResourceAllocationSettingData() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The address of the resource. For example, the MAC address of a Ethernet
|
|
||||||
* port.
|
|
||||||
*/
|
|
||||||
public String getAddress() {
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 ordering of devices on a controller.For example,
|
|
||||||
* if the parent is a PCI Controller, this property would specify the PCI
|
|
||||||
* slot of this child device.
|
|
||||||
*/
|
|
||||||
public String getAddressOnParent() {
|
|
||||||
return addressOnParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies the units of allocation used by the Reservation
|
|
||||||
* and Limit properties. For example, when ResourceType=Processor,
|
|
||||||
* AllocationUnits may be set to hertz*10^6 or percent. When
|
|
||||||
* ResourceType=Memory, AllocationUnits may be set to bytes*10^3. It is
|
|
||||||
* expected that profiles constrain 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 getAllocationUnits() {
|
|
||||||
return allocationUnits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies if the resource will be automatically allocated.
|
|
||||||
* For example when set to true, when the consuming virtual computer system
|
|
||||||
* is powered on, this resource would be allocated. A value of false
|
|
||||||
* indicates the resource must be explicitly allocated. For example, the
|
|
||||||
* 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() {
|
|
||||||
return automaticAllocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies if the resource will be automatically
|
|
||||||
* de-allocated. For example, when set to true, when the consuming virtual
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
public Boolean isAutomaticDeallocation() {
|
|
||||||
return automaticDeallocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Describes the consumers visibility to the allocated resource.
|
|
||||||
*/
|
|
||||||
public ConsumerVisibility getConsumerVisibility() {
|
|
||||||
return consumerVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies the upper bound, or maximum amount of resource
|
|
||||||
* that will be granted for this allocation. For example, a system which
|
|
||||||
* supports memory paging may support setting the Limit of a Memory
|
|
||||||
* allocation below that of the VirtualQuantity, thus forcing paging to occur
|
|
||||||
* 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() {
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies how this resource maps to underlying resourcesIf the
|
|
||||||
* HostResource array contains any entries, this property reflects how the
|
|
||||||
* resource maps to those specific resources.
|
|
||||||
*/
|
|
||||||
public MappingBehavior getMappingBehavior() {
|
|
||||||
return mappingBehavior;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string that describes the resource type when a well defined value is not
|
|
||||||
* available and ResourceType has the value "Other".
|
|
||||||
*/
|
|
||||||
public String getOtherResourceType() {
|
|
||||||
return otherResourceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Parent of the resource. For example, a controller for the current
|
|
||||||
* allocation
|
|
||||||
*/
|
|
||||||
public String getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies which ResourcePool the resource is currently
|
|
||||||
* allocated from, or which ResourcePool the resource will be allocated from
|
|
||||||
* when the allocation occurs.
|
|
||||||
*/
|
|
||||||
public String getPoolID() {
|
|
||||||
return poolID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies the amount of resource guaranteed to be available
|
|
||||||
* for this allocation. On system which support over-commitment of resources,
|
|
||||||
* this value is typically used for admission control to prevent an an
|
|
||||||
* allocation from being accepted thus preventing starvation. The value of
|
|
||||||
* the Reservation property is expressed in the unit specified by the value
|
|
||||||
* of the AllocationUnits property.
|
|
||||||
*/
|
|
||||||
public Long getReservation() {
|
|
||||||
return reservation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A string describing an implementation specific sub-type for this resource.
|
|
||||||
* F
|
|
||||||
*/
|
|
||||||
public String getResourceSubType() {
|
|
||||||
return resourceSubType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of resource this allocation setting represents.
|
|
||||||
*/
|
|
||||||
public ResourceType getResourceType() {
|
|
||||||
return resourceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies the quantity of resources presented to the
|
|
||||||
* consumer. For example, when ResourceType=Processor, this property would
|
|
||||||
* reflect the number of discrete Processors presented to the virtual
|
|
||||||
* computer system. When ResourceType=Memory, this property could reflect the
|
|
||||||
* number of MB reported to the virtual computer system. The value of the
|
|
||||||
* VirtualQuantity property should be expressed in units as defined by the
|
|
||||||
* value of the VirtualQuantityUnits property.
|
|
||||||
*/
|
|
||||||
public Long getVirtualQuantity() {
|
|
||||||
return virtualQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies the units used by the VirtualQuantity property.
|
|
||||||
* For example - if ResourceType=Processor, the value of the
|
|
||||||
* VirtualQuantityUnits property may be set to "count", indicating that the
|
|
||||||
* value of the VirtualQuantity property is expressed as a count. - if
|
|
||||||
* ResourceType=Memory, the value of the VirtualQuantityUnits property may be
|
|
||||||
* set to "bytes*10^3", indicating that the value of the VirtualQuantity
|
|
||||||
* property is expressed in kilobyte. It is expected that profiles constrain
|
|
||||||
* 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() {
|
|
||||||
return virtualQuantityUnits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property specifies a relative priority for this allocation in
|
|
||||||
* relation to other allocations from the same ResourcePool. This property
|
|
||||||
* has no unit of measure, and is only relevant when compared to other
|
|
||||||
* allocations vying for the same host resources.
|
|
||||||
*/
|
|
||||||
public Integer getWeight() {
|
|
||||||
return weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The thing to which this resource is connected. For example, a named
|
|
||||||
* network or switch port.
|
|
||||||
*/
|
|
||||||
public List<String> getConnections() {
|
|
||||||
return connections;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property exposes specific assignment of resources. Each non-null
|
|
||||||
* value of the HostResource property shall be formated as a URI per RFC3986.
|
|
||||||
* If this resource is modeled then a value should be a WBEM URI (DSP0207).
|
|
||||||
* If the resource is not modeled then see the appropriate profile. Profiles
|
|
||||||
* may further constrain the type of URI. A NULL value or empty array
|
|
||||||
* requests the implementation decide the kind of host resource. If the
|
|
||||||
* virtual resource is mapped to more than oneunderlying resource, this
|
|
||||||
* property may be left NULL. If NULL, the DeviceAllocatedFromPool or
|
|
||||||
* ResourceAllocationFromPool associations may be used to determine the pool
|
|
||||||
* of host resources this virtual resource may use. If specific assignment is
|
|
||||||
* utilized, all underlying resources used by this virtual resource should be
|
|
||||||
* listed.The kind of dependency is specified by the ConsumerVisibility and
|
|
||||||
* 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() {
|
|
||||||
return hostResources;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String
|
|
||||||
.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, instanceID, caption, description, address, addressOnParent, allocationUnits,
|
|
||||||
automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
|
|
||||||
mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
|
|
||||||
virtualQuantity, virtualQuantityUnits, weight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = super.hashCode();
|
|
||||||
result = prime * result + ((address == null) ? 0 : address.hashCode());
|
|
||||||
result = prime * result + ((addressOnParent == null) ? 0 : addressOnParent.hashCode());
|
|
||||||
result = prime * result + ((resourceSubType == null) ? 0 : resourceSubType.hashCode());
|
|
||||||
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (!super.equals(obj))
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
ResourceAllocationSettingData other = (ResourceAllocationSettingData) obj;
|
|
||||||
if (address == null) {
|
|
||||||
if (other.address != null)
|
|
||||||
return false;
|
|
||||||
} else if (!address.equals(other.address))
|
|
||||||
return false;
|
|
||||||
if (addressOnParent == null) {
|
|
||||||
if (other.addressOnParent != null)
|
|
||||||
return false;
|
|
||||||
} else if (!addressOnParent.equals(other.addressOnParent))
|
|
||||||
return false;
|
|
||||||
if (resourceSubType == null) {
|
|
||||||
if (other.resourceSubType != null)
|
|
||||||
return false;
|
|
||||||
} else if (!resourceSubType.equals(other.resourceSubType))
|
|
||||||
return false;
|
|
||||||
if (resourceType == null) {
|
|
||||||
if (other.resourceType != null)
|
|
||||||
return false;
|
|
||||||
} else if (!resourceType.equals(other.resourceType))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,582 +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.cim;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* CIM_VirtualSystemSettingData defines the virtual aspects of a virtual system through a set of
|
|
||||||
* virtualization specific properties. CIM_VirtualSystemSettingData is also used as the top level
|
|
||||||
* class of virtual system configurations. Virtual system configurations model configuration
|
|
||||||
* information about virtual systems and their components. A virtual system configuration consists
|
|
||||||
* of one top-level instance of class CIM_VirtualSystemSettingData that aggregates a number of
|
|
||||||
* instances of class CIM_ResourceAllocationSettingData, using association CIM_ConcreteComponent.
|
|
||||||
* Virtual system configurations may for example be used to reflect configurations of - virtual
|
|
||||||
* systems that are defined at a virtualization platform, - virtual systems that are currently
|
|
||||||
* active, - input requests to create new virtual systems, - input requests to modify existing
|
|
||||||
* virtual systems, or - snapshots of virtual systems.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @see <a
|
|
||||||
* href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip"
|
|
||||||
* />
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class VirtualSystemSettingData extends ManagedElement {
|
|
||||||
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromVirtualSystemSettingData(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends ManagedElement.Builder {
|
|
||||||
private AutomaticRecoveryAction automaticRecoveryAction;
|
|
||||||
private AutomaticShutdownAction automaticShutdownAction;
|
|
||||||
private AutomaticStartupAction automaticStartupAction;
|
|
||||||
private Long automaticStartupActionDelay;
|
|
||||||
private Integer automaticStartupActionSequenceNumber;
|
|
||||||
private URI configurationDataRoot;
|
|
||||||
private URI configurationFile;
|
|
||||||
private String configurationID;
|
|
||||||
private Date creationTime;
|
|
||||||
private URI logDataRoot;
|
|
||||||
private URI recoveryFile;
|
|
||||||
private URI snapshotDataRoot;
|
|
||||||
private URI suspendDataRoot;
|
|
||||||
private URI swapFileDataRoot;
|
|
||||||
private String virtualSystemIdentifier;
|
|
||||||
private Set<String> virtualSystemTypes = Sets.newLinkedHashSet();
|
|
||||||
private String notes;
|
|
||||||
|
|
||||||
public Builder automaticRecoveryAction(AutomaticRecoveryAction automaticRecoveryAction) {
|
|
||||||
this.automaticRecoveryAction = automaticRecoveryAction;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder automaticShutdownAction(AutomaticShutdownAction automaticShutdownAction) {
|
|
||||||
this.automaticShutdownAction = automaticShutdownAction;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder automaticStartupAction(AutomaticStartupAction automaticStartupAction) {
|
|
||||||
this.automaticStartupAction = automaticStartupAction;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder automaticStartupActionDelay(Long automaticStartupActionDelay) {
|
|
||||||
this.automaticStartupActionDelay = automaticStartupActionDelay;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder automaticStartupActionSequenceNumber(Integer automaticStartupActionSequenceNumber) {
|
|
||||||
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder configurationDataRoot(URI configurationDataRoot) {
|
|
||||||
this.configurationDataRoot = configurationDataRoot;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder configurationFile(URI configurationFile) {
|
|
||||||
this.configurationFile = configurationFile;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder configurationID(String configurationID) {
|
|
||||||
this.configurationID = configurationID;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder creationTime(Date creationTime) {
|
|
||||||
this.creationTime = creationTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder logDataRoot(URI logDataRoot) {
|
|
||||||
this.logDataRoot = logDataRoot;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder recoveryFile(URI recoveryFile) {
|
|
||||||
this.recoveryFile = recoveryFile;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder snapshotDataRoot(URI snapshotDataRoot) {
|
|
||||||
this.snapshotDataRoot = snapshotDataRoot;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder suspendDataRoot(URI suspendDataRoot) {
|
|
||||||
this.suspendDataRoot = suspendDataRoot;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder swapFileDataRoot(URI swapFileDataRoot) {
|
|
||||||
this.swapFileDataRoot = swapFileDataRoot;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder virtualSystemIdentifier(String virtualSystemIdentifier) {
|
|
||||||
this.virtualSystemIdentifier = virtualSystemIdentifier;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder virtualSystemTypes(Iterable<String> virtualSystemTypes) {
|
|
||||||
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder virtualSystemType(String virtualSystemType) {
|
|
||||||
this.virtualSystemTypes.add(checkNotNull(virtualSystemType, "virtualSystemType"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder notes(String notes) {
|
|
||||||
this.notes = notes;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VirtualSystemSettingData build() {
|
|
||||||
return new VirtualSystemSettingData(elementName, instanceID, caption, description, automaticRecoveryAction,
|
|
||||||
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
|
|
||||||
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile, configurationID,
|
|
||||||
creationTime, logDataRoot, recoveryFile, snapshotDataRoot, suspendDataRoot, swapFileDataRoot,
|
|
||||||
virtualSystemIdentifier, virtualSystemTypes, notes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromVirtualSystemSettingData(VirtualSystemSettingData in) {
|
|
||||||
return fromManagedElement(in).automaticRecoveryAction(in.getAutomaticRecoveryAction())
|
|
||||||
.automaticShutdownAction(in.getAutomaticShutdownAction()).automaticStartupAction(
|
|
||||||
in.getAutomaticStartupAction()).automaticStartupActionDelay(
|
|
||||||
in.getAutomaticStartupActionDelay()).automaticStartupActionSequenceNumber(
|
|
||||||
in.getAutomaticStartupActionSequenceNumber()).configurationDataRoot(
|
|
||||||
in.getConfigurationDataRoot()).configurationFile(in.getConfigurationFile()).configurationID(
|
|
||||||
in.getConfigurationID()).creationTime(in.getCreationTime()).logDataRoot(in.getLogDataRoot())
|
|
||||||
.recoveryFile(in.getRecoveryFile()).snapshotDataRoot(in.getSnapshotDataRoot()).suspendDataRoot(
|
|
||||||
in.getSuspendDataRoot()).swapFileDataRoot(in.getSwapFileDataRoot()).virtualSystemIdentifier(
|
|
||||||
in.getVirtualSystemIdentifier()).virtualSystemTypes(in.getVirtualSystemTypes()).notes(
|
|
||||||
in.getNotes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* non-interuptable wait state condition.
|
|
||||||
*/
|
|
||||||
public static enum AutomaticRecoveryAction {
|
|
||||||
|
|
||||||
NONE(2),
|
|
||||||
|
|
||||||
RESTART(3),
|
|
||||||
|
|
||||||
REVERT_TO_SNAPSHOT(4);
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
AutomaticRecoveryAction(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, AutomaticRecoveryAction> AUTOMATIC_RECOVERY_ACTION_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(AutomaticRecoveryAction.values()), new Function<AutomaticRecoveryAction, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(AutomaticRecoveryAction input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static AutomaticRecoveryAction fromValue(String automaticRecoveryAction) {
|
|
||||||
return AUTOMATIC_RECOVERY_ACTION_BY_ID.get(new Integer(checkNotNull(automaticRecoveryAction,
|
|
||||||
"automaticRecoveryAction")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action to take for the virtual system when the host is shut down.
|
|
||||||
*/
|
|
||||||
public static enum AutomaticShutdownAction {
|
|
||||||
|
|
||||||
TURN_OFF(2),
|
|
||||||
|
|
||||||
SAVE_STATE(3),
|
|
||||||
|
|
||||||
SHUTDOWN(4);
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
AutomaticShutdownAction(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, AutomaticShutdownAction> AUTOMATIC_SHUTDOWN_ACTION_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(AutomaticShutdownAction.values()), new Function<AutomaticShutdownAction, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(AutomaticShutdownAction input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static AutomaticShutdownAction fromValue(String automaticShutdownAction) {
|
|
||||||
return AUTOMATIC_SHUTDOWN_ACTION_BY_ID.get(new Integer(checkNotNull(automaticShutdownAction,
|
|
||||||
"automaticShutdownAction")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action to take for the virtual system when the host is started.
|
|
||||||
*/
|
|
||||||
public static enum AutomaticStartupAction {
|
|
||||||
|
|
||||||
NONE(2),
|
|
||||||
|
|
||||||
RESTART_IF_PREVIOUSLY_ACTIVE(3),
|
|
||||||
|
|
||||||
ALWAYS_STARTUP(4);
|
|
||||||
|
|
||||||
protected final int code;
|
|
||||||
|
|
||||||
AutomaticStartupAction(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return code + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final static Map<Integer, AutomaticStartupAction> AUTOMATIC_STARTUP_ACTION_BY_ID = Maps.uniqueIndex(
|
|
||||||
ImmutableSet.copyOf(AutomaticStartupAction.values()), new Function<AutomaticStartupAction, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer apply(AutomaticStartupAction input) {
|
|
||||||
return input.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public static AutomaticStartupAction fromValue(String automaticStartupAction) {
|
|
||||||
return AUTOMATIC_STARTUP_ACTION_BY_ID.get(new Integer(checkNotNull(automaticStartupAction,
|
|
||||||
"automaticStartupAction")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private AutomaticRecoveryAction automaticRecoveryAction;
|
|
||||||
private AutomaticShutdownAction automaticShutdownAction;
|
|
||||||
private AutomaticStartupAction automaticStartupAction;
|
|
||||||
private Long automaticStartupActionDelay;
|
|
||||||
private Integer automaticStartupActionSequenceNumber;
|
|
||||||
private URI configurationDataRoot;
|
|
||||||
private URI configurationFile;
|
|
||||||
private String configurationID;
|
|
||||||
private Date creationTime;
|
|
||||||
private URI logDataRoot;
|
|
||||||
private URI recoveryFile;
|
|
||||||
private URI snapshotDataRoot;
|
|
||||||
private URI suspendDataRoot;
|
|
||||||
private URI swapFileDataRoot;
|
|
||||||
private String virtualSystemIdentifier;
|
|
||||||
private Set<String> virtualSystemTypes;
|
|
||||||
private String notes;
|
|
||||||
|
|
||||||
private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description,
|
|
||||||
AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction,
|
|
||||||
AutomaticStartupAction automaticStartupAction, Long automaticStartupActionDelay,
|
|
||||||
Integer automaticStartupActionSequenceNumber, URI configurationDataRoot, URI configurationFile,
|
|
||||||
String configurationID, Date creationTime, URI logDataRoot, URI recoveryFile, URI snapshotDataRoot,
|
|
||||||
URI suspendDataRoot, URI swapFileDataRoot, String virtualSystemIdentifier,
|
|
||||||
Iterable<String> virtualSystemTypes, String notes) {
|
|
||||||
super(elementName, instanceID, caption, description);
|
|
||||||
this.automaticRecoveryAction = automaticRecoveryAction;
|
|
||||||
this.automaticShutdownAction = automaticShutdownAction;
|
|
||||||
this.automaticStartupAction = automaticStartupAction;
|
|
||||||
this.automaticStartupActionDelay = automaticStartupActionDelay;
|
|
||||||
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
|
|
||||||
this.configurationDataRoot = configurationDataRoot;
|
|
||||||
this.configurationFile = configurationFile;
|
|
||||||
this.configurationID = configurationID;
|
|
||||||
this.creationTime = creationTime;
|
|
||||||
this.logDataRoot = logDataRoot;
|
|
||||||
this.recoveryFile = recoveryFile;
|
|
||||||
this.snapshotDataRoot = snapshotDataRoot;
|
|
||||||
this.suspendDataRoot = suspendDataRoot;
|
|
||||||
this.swapFileDataRoot = swapFileDataRoot;
|
|
||||||
this.virtualSystemIdentifier = virtualSystemIdentifier;
|
|
||||||
this.virtualSystemTypes = ImmutableSet.copyOf(checkNotNull(virtualSystemTypes, "virtualSystemTypes"));
|
|
||||||
this.notes = notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
private VirtualSystemSettingData() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* non-interuptable wait state condition.
|
|
||||||
*/
|
|
||||||
public AutomaticRecoveryAction getAutomaticRecoveryAction() {
|
|
||||||
return automaticRecoveryAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action to take for the virtual system when the host is shut down.
|
|
||||||
*/
|
|
||||||
public AutomaticShutdownAction getAutomaticShutdownAction() {
|
|
||||||
return automaticShutdownAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action to take for the virtual system when the host is started.
|
|
||||||
*/
|
|
||||||
public AutomaticStartupAction getAutomaticStartupAction() {
|
|
||||||
return automaticStartupAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delay applicable to startup action. The value shall be in the interval variant of the datetime
|
|
||||||
* datatype.
|
|
||||||
*/
|
|
||||||
public Long getAutomaticStartupActionDelay() {
|
|
||||||
return automaticStartupActionDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number indicating the relative sequence of virtual system activation when the host system is
|
|
||||||
* started. A lower number indicates earlier activation. If one or more configurations show the
|
|
||||||
* same value, the sequence is implementation dependent. A value of 0 indicates that the sequence
|
|
||||||
* is implementation dependent.
|
|
||||||
*/
|
|
||||||
public Integer getAutomaticStartupActionSequenceNumber() {
|
|
||||||
return automaticStartupActionSequenceNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a directory where information about the virtual system configuration is
|
|
||||||
* stored.Format shall be URI based on RFC 2079.
|
|
||||||
*/
|
|
||||||
public URI getConfigurationDataRoot() {
|
|
||||||
return configurationDataRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a file where information about the virtual system configuration is stored. A
|
|
||||||
* relative path appends to the value of the ConfigurationDataRoot property.Format shall be URI
|
|
||||||
* based on RFC 2079.
|
|
||||||
*/
|
|
||||||
public URI getConfigurationFile() {
|
|
||||||
return configurationFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique id of the virtual system configuration. Note that the ConfigurationID is different from
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
public String getConfigurationID() {
|
|
||||||
return configurationID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Time when the virtual system configuration was created.
|
|
||||||
*/
|
|
||||||
public Date getCreationTime() {
|
|
||||||
return creationTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a directory where log 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.
|
|
||||||
*/
|
|
||||||
public URI getLogDataRoot() {
|
|
||||||
return logDataRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a file where recovery relateded information of the virtual system is stored.Format
|
|
||||||
* shall be URI based on RFC 2079.
|
|
||||||
*/
|
|
||||||
public URI getRecoveryFile() {
|
|
||||||
return recoveryFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a directory where information about virtual system snapshots is stored. A relative
|
|
||||||
* path appends to the value of the ConfigurationDataRoot property.Format shall be URI based on
|
|
||||||
* RFC 2079.
|
|
||||||
*/
|
|
||||||
public URI getSnapshotDataRoot() {
|
|
||||||
return snapshotDataRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
public URI getSuspendDataRoot() {
|
|
||||||
return suspendDataRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filepath of a directory where swapfiles of the virtual system are stored. A relative path
|
|
||||||
* appends to the value of the ConfigurationDataRoot property.Format shall be URI based on RFC
|
|
||||||
* 2079.
|
|
||||||
*/
|
|
||||||
public URI getSwapFileDataRoot() {
|
|
||||||
return swapFileDataRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* may contain implementation specific rules (like simple patterns or regular expresssion) that
|
|
||||||
* may be interpreted by the implementation when assigning a VirtualSystemIdentifier.
|
|
||||||
*/
|
|
||||||
public String getVirtualSystemIdentifier() {
|
|
||||||
return virtualSystemIdentifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VirtualSystemType shall reflect a particular type of virtual system.
|
|
||||||
*/
|
|
||||||
public Set<String> getVirtualSystemTypes() {
|
|
||||||
return virtualSystemTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* End-user supplied notes that are related to the virtual system.
|
|
||||||
*/
|
|
||||||
public String getNotes() {
|
|
||||||
return notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = super.hashCode();
|
|
||||||
result = prime * result + ((virtualSystemIdentifier == null) ? 0 : virtualSystemIdentifier.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (!super.equals(obj))
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
VirtualSystemSettingData other = (VirtualSystemSettingData) obj;
|
|
||||||
if (virtualSystemIdentifier == null) {
|
|
||||||
if (other.virtualSystemIdentifier != null)
|
|
||||||
return false;
|
|
||||||
} else if (!virtualSystemIdentifier.equals(other.virtualSystemIdentifier))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String
|
|
||||||
.format(
|
|
||||||
"[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]",
|
|
||||||
elementName, instanceID, caption, description, automaticRecoveryAction,
|
|
||||||
automaticShutdownAction, automaticStartupAction, automaticStartupActionDelay,
|
|
||||||
automaticStartupActionSequenceNumber, configurationDataRoot, configurationFile,
|
|
||||||
configurationID, creationTime, logDataRoot, notes, recoveryFile, snapshotDataRoot,
|
|
||||||
suspendDataRoot, swapFileDataRoot, virtualSystemIdentifier, virtualSystemTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +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.cim;
|
|
||||||
|
|
|
@ -1,155 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = {
|
|
||||||
"label", "description"
|
|
||||||
})
|
|
||||||
public class Configuration {
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
protected String id;
|
|
||||||
protected boolean isDefault;
|
|
||||||
protected String label;
|
|
||||||
protected String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Configuration#getId
|
|
||||||
*/
|
|
||||||
public Builder id(String id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Configuration#getLabel
|
|
||||||
*/
|
|
||||||
public Builder label(String label) {
|
|
||||||
this.label = label;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Configuration#getDescription
|
|
||||||
*/
|
|
||||||
public Builder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Configuration#isDefault
|
|
||||||
*/
|
|
||||||
public Builder isDefault(boolean isDefault) {
|
|
||||||
this.isDefault = isDefault;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Configuration build() {
|
|
||||||
return new Configuration(id, isDefault, label, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromConfiguration(Configuration in) {
|
|
||||||
return id(in.getId()).description(in.getDescription()).label(in.getLabel());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
private String id;
|
|
||||||
@XmlAttribute(name = "default")
|
|
||||||
private boolean isDefault;
|
|
||||||
@XmlElement(name = "Label")
|
|
||||||
private String label;
|
|
||||||
@XmlElement(name = "Description")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
public Configuration(String id, boolean isDefault, String label, String description) {
|
|
||||||
this.id = id;
|
|
||||||
this.label = label;
|
|
||||||
this.description = description;
|
|
||||||
this.isDefault = isDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Configuration() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(id, label, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Configuration other = (Configuration) obj;
|
|
||||||
return Objects.equal(id, other.id)
|
|
||||||
&& Objects.equal(label, other.label)
|
|
||||||
&& Objects.equal(description, other.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return string().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return Objects.toStringHelper("").add("id", id).add("default", isDefault).add("label", label).add("description", description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDefault() {
|
|
||||||
return isDefault;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,147 +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.ovf;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The DeploymentOptionSection specifies a discrete set of intended resource configurations. The
|
|
||||||
* author of an OVF package can include sizing metadata for different configurations. A consumer of
|
|
||||||
* the OVF shall select a configuration, for example, by prompting the user. The selected
|
|
||||||
* configuration is visible in the OVF environment, enabling guest software to adapt to the selected
|
|
||||||
* configuration.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "DeploymentOptionSection", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromDeploymentOptionSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<DeploymentOptionSection> {
|
|
||||||
protected Set<Configuration> configurations = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see DeploymentOptionSection#getConfigurations
|
|
||||||
*/
|
|
||||||
public Builder configuration(Configuration configuration) {
|
|
||||||
this.configurations.add(checkNotNull(configuration, "configuration"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see DeploymentOptionSection#getConfigurations
|
|
||||||
*/
|
|
||||||
public Builder configurations(Iterable<Configuration> configurations) {
|
|
||||||
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DeploymentOptionSection build() {
|
|
||||||
return new DeploymentOptionSection(info, configurations);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromDeploymentOptionSection(DeploymentOptionSection in) {
|
|
||||||
return info(in.getInfo()).configurations(in.getConfigurations());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<DeploymentOptionSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlElement(name = "Configuration")
|
|
||||||
protected Set<Configuration> configurations;
|
|
||||||
|
|
||||||
private DeploymentOptionSection(String info, Iterable<Configuration> configurations) {
|
|
||||||
super(info);
|
|
||||||
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private DeploymentOptionSection() {
|
|
||||||
// For JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), configurations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (!super.equals(obj)) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
DeploymentOptionSection other = (DeploymentOptionSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(configurations, other.configurations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("configurations", configurations);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Configuration> getConfigurations() {
|
|
||||||
return configurations;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,247 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "Disk", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class Disk implements Comparable<Disk>{
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
private String id;
|
|
||||||
private Long capacity;
|
|
||||||
private String parentRef;
|
|
||||||
private String fileRef;
|
|
||||||
private URI format;
|
|
||||||
private Long populatedSize;
|
|
||||||
private String capacityAllocationUnits;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getId
|
|
||||||
*/
|
|
||||||
public Builder id(String id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getCapacity
|
|
||||||
*/
|
|
||||||
public Builder capacity(Long capacity) {
|
|
||||||
this.capacity = capacity;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getParentRef
|
|
||||||
*/
|
|
||||||
public Builder parentRef(String parentRef) {
|
|
||||||
this.parentRef = parentRef;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getFileRef
|
|
||||||
*/
|
|
||||||
public Builder fileRef(String fileRef) {
|
|
||||||
this.fileRef = fileRef;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getFormat
|
|
||||||
*/
|
|
||||||
public Builder format(URI format) {
|
|
||||||
this.format = format;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getPopulatedSize
|
|
||||||
*/
|
|
||||||
public Builder populatedSize(Long populatedSize) {
|
|
||||||
this.populatedSize = populatedSize;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Disk#getCapacityAllocationUnits
|
|
||||||
*/
|
|
||||||
public Builder capacityAllocationUnits(String capacityAllocationUnits) {
|
|
||||||
this.capacityAllocationUnits = capacityAllocationUnits;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Disk build() {
|
|
||||||
return new Disk(id, capacity, parentRef, fileRef, format, populatedSize, capacityAllocationUnits);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromDisk(Disk in) {
|
|
||||||
return id(in.getId()).capacity(in.getCapacity()).parentRef(in.getParentRef()).fileRef(in.getFileRef()).format(
|
|
||||||
in.getFormat()).populatedSize(in.getPopulatedSize()).capacityAllocationUnits(
|
|
||||||
in.getCapacityAllocationUnits());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private Long capacity;
|
|
||||||
private String parentRef;
|
|
||||||
private String fileRef;
|
|
||||||
private URI format;
|
|
||||||
private Long populatedSize;
|
|
||||||
private String capacityAllocationUnits;
|
|
||||||
|
|
||||||
private Disk(String id, Long capacity, String parentRef, String fileRef, URI format, Long populatedSize,
|
|
||||||
String capacityAllocationUnits) {
|
|
||||||
this.id = id;
|
|
||||||
this.capacity = capacity;
|
|
||||||
this.parentRef = parentRef;
|
|
||||||
this.fileRef = fileRef;
|
|
||||||
this.format = format;
|
|
||||||
this.populatedSize = populatedSize;
|
|
||||||
this.capacityAllocationUnits = capacityAllocationUnits;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Disk() {
|
|
||||||
// For Jaxb
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Each virtual disk is represented by a Disk element that shall be given a identifier using the
|
|
||||||
* {@code id} attribute, the identifier shall be unique within the {@link DiskSection}.
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The capacity of a virtual disk shall be specified by the {@code capacity} attribute with an
|
|
||||||
* xs:long integer value. The default unit of allocation shall be bytes.
|
|
||||||
*/
|
|
||||||
public Long getCapacity() {
|
|
||||||
return capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OVF allows a disk image to be represented as a set of modified blocks in comparison to a
|
|
||||||
* parent image. The use of parent disks can often significantly reduce the size of an OVF
|
|
||||||
* package, if it contains multiple disks with similar content. For a Disk element, a parent disk
|
|
||||||
* may optionally be specified using the {@code parentRef} attribute, which shall contain a valid
|
|
||||||
* ovf:id reference to a different Disk element. If a disk block does not exist locally, lookup
|
|
||||||
* for that disk block then occurs in the parent disk. In {@link DiskSection}, parent Disk
|
|
||||||
* elements shall occur before child Disk elements that refer to them.
|
|
||||||
*/
|
|
||||||
public String getParentRef() {
|
|
||||||
return parentRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ovf:fileRef attribute denotes the virtual disk content by identifying an existing File
|
|
||||||
* element in the References element, the File element is identified by matching its {@code id}
|
|
||||||
* attribute value with the {@code fileRef} attribute value. Omitting the {@code fileRef}
|
|
||||||
* attribute shall indicate an empty disk. In this case, the disk shall be created and the entire
|
|
||||||
* disk content zeroed at installation time. The guest software will typically format empty disks
|
|
||||||
* in some file system format.
|
|
||||||
*/
|
|
||||||
public String getFileRef() {
|
|
||||||
return fileRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The format URI of a non-empty virtual disk shall be specified by the {@code format} attribute.
|
|
||||||
*/
|
|
||||||
public URI getFormat() {
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For non-empty disks, the actual used size of the disk may optionally be specified using the
|
|
||||||
* {@code populatedSize} attribute. The unit of this attribute is always bytes. {@code
|
|
||||||
* populatedSize} is allowed to be an estimate of used disk size but shall not be larger than
|
|
||||||
* {@code capacity}.
|
|
||||||
*/
|
|
||||||
public Long getPopulatedSize() {
|
|
||||||
return populatedSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The optional string attribute {@code ovf:capacityAllocationUnits} may be used to specify a
|
|
||||||
* particular unit of allocation. Values for {@code ovf:capacityAllocationUnits} shall match the
|
|
||||||
* format for programmatic units defined in DSP0004.
|
|
||||||
*/
|
|
||||||
public String getCapacityAllocationUnits() {
|
|
||||||
return capacityAllocationUnits;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.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;
|
|
||||||
Disk other = (Disk) obj;
|
|
||||||
if (id == null) {
|
|
||||||
if (other.id != null)
|
|
||||||
return false;
|
|
||||||
} else if (!id.equals(other.id))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String
|
|
||||||
.format(
|
|
||||||
"[id=%s, capacity=%s, capacityAllocationUnits=%s, fileRef=%s, format=%s, parentRef=%s, populatedSize=%s]",
|
|
||||||
id, capacity, capacityAllocationUnits, fileRef, format, parentRef, populatedSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int compareTo(Disk o) {
|
|
||||||
if (id == null)
|
|
||||||
return -1;
|
|
||||||
return (this == o) ? 0 : id.compareTo(o.id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,152 +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.ovf;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A DiskSection describes meta-information about virtual disks in the OVF package. Virtual disks
|
|
||||||
* and their metadata are described outside the virtual hardware to facilitate sharing between
|
|
||||||
* virtual machines within an OVF package.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS)
|
|
||||||
@XmlType(propOrder = {
|
|
||||||
"disks"
|
|
||||||
})
|
|
||||||
public class DiskSection extends SectionType<DiskSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return new Builder().fromDiskSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<DiskSection> {
|
|
||||||
protected Set<Disk> disks = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see DiskSection#getDisks
|
|
||||||
*/
|
|
||||||
public Builder disk(Disk disk) {
|
|
||||||
this.disks.add(checkNotNull(disk, "disk"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see DiskSection#getDisks
|
|
||||||
*/
|
|
||||||
public Builder disks(Iterable<Disk> disks) {
|
|
||||||
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DiskSection build() {
|
|
||||||
return new DiskSection(info, disks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromDiskSection(DiskSection in) {
|
|
||||||
return disks(in.getDisks()).info(in.getInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<DiskSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<Disk> disks;
|
|
||||||
|
|
||||||
private DiskSection(String info, Iterable<Disk> disks) {
|
|
||||||
super(info);
|
|
||||||
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private DiskSection() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All disks referred to from Connection elements in all {@link VirtualHardwareSection} elements
|
|
||||||
* shall be defined in the DiskSection.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set<Disk> getDisks() {
|
|
||||||
return disks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), disks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
DiskSection other = (DiskSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(disks, other.disks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("disks", disks);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,138 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.internal.BaseEnvelope;
|
|
||||||
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return new Builder().fromEnvelope(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends BaseEnvelope.Builder<VirtualSystem, Envelope> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Envelope build() {
|
|
||||||
return new Envelope(diskSections, networkSections, additionalSections, virtualSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public Builder additionalSection(String name, SectionType additionalSection) {
|
|
||||||
return Builder.class.cast(super.additionalSection(name, additionalSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public Builder additionalSections(Multimap<String, SectionType> additionalSections) {
|
|
||||||
return Builder.class.cast(super.additionalSections(additionalSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder diskSection(DiskSection diskSection) {
|
|
||||||
return Builder.class.cast(super.diskSection(diskSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder diskSections(Iterable<? extends DiskSection> diskSections) {
|
|
||||||
return Builder.class.cast(super.diskSections(diskSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromEnvelope(BaseEnvelope<VirtualSystem, Envelope> in) {
|
|
||||||
return Builder.class.cast(super.fromEnvelope(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder networkSection(NetworkSection networkSection) {
|
|
||||||
return Builder.class.cast(super.networkSection(networkSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder networkSections(Iterable<? extends NetworkSection> networkSections) {
|
|
||||||
return Builder.class.cast(super.networkSections(networkSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder virtualSystem(VirtualSystem virtualSystem) {
|
|
||||||
return Builder.class.cast(super.virtualSystem(virtualSystem));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Envelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections,
|
|
||||||
Multimap<String, SectionType> additionalSections, VirtualSystem virtualSystem) {
|
|
||||||
super(diskSections, networkSections, additionalSections, virtualSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Envelope() {
|
|
||||||
// For JaxB
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,123 +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.ovf;
|
|
||||||
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "Network", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class Network {
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
protected String name;
|
|
||||||
protected String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Network#getName
|
|
||||||
*/
|
|
||||||
public Builder name(String name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Network#getDescription
|
|
||||||
*/
|
|
||||||
public Builder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Network build() {
|
|
||||||
return new Network(name, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromNetwork(Network in) {
|
|
||||||
return name(in.getName()).description(in.getDescription());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
protected Network(String name, String description) {
|
|
||||||
this.name = name;
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Network() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
|
||||||
result = prime * result + ((name == null) ? 0 : name.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;
|
|
||||||
Network other = (Network) obj;
|
|
||||||
if (description == null) {
|
|
||||||
if (other.description != null)
|
|
||||||
return false;
|
|
||||||
} else if (!description.equals(other.description))
|
|
||||||
return false;
|
|
||||||
if (name == null) {
|
|
||||||
if (other.name != null)
|
|
||||||
return false;
|
|
||||||
} else if (!name.equals(other.name))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "[name=" + name + ", description=" + description + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,149 +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.ovf;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The NetworkSection element shall list all logical networks used in the OVF package.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "NetworkSection", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class NetworkSection extends SectionType<NetworkSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromNetworkSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<NetworkSection> {
|
|
||||||
protected Set<Network> networks = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see NetworkSection#getNetworks
|
|
||||||
*/
|
|
||||||
public Builder network(Network network) {
|
|
||||||
this.networks.add(checkNotNull(network, "network"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see NetworkSection#getNetworks
|
|
||||||
*/
|
|
||||||
public Builder networks(Iterable<Network> networks) {
|
|
||||||
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public NetworkSection build() {
|
|
||||||
return new NetworkSection(info, networks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromNetworkSection(NetworkSection in) {
|
|
||||||
return networks(in.getNetworks()).info(in.getInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<NetworkSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<Network> networks;
|
|
||||||
|
|
||||||
private NetworkSection(String info, Iterable<Network> networks) {
|
|
||||||
super(info);
|
|
||||||
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private NetworkSection() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All networks referred to from Connection elements in all {@link VirtualHardwareSection}
|
|
||||||
* elements shall be defined in the NetworkSection.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set<Network> getNetworks() {
|
|
||||||
return networks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), networks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
NetworkSection other = (NetworkSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(networks, other.networks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("networks", networks);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,172 +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.ovf;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An OperatingSystemSection specifies the operating system installed on a virtual machine.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "VirtualHardwareSection")
|
|
||||||
public class OperatingSystemSection extends SectionType<OperatingSystemSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromOperatingSystemSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<OperatingSystemSection> {
|
|
||||||
private Integer id;
|
|
||||||
private String description;
|
|
||||||
private String version;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see OperatingSystemSection#getId()
|
|
||||||
*/
|
|
||||||
public Builder id(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see OperatingSystemSection#getVersion()
|
|
||||||
*/
|
|
||||||
public Builder version(String version) {
|
|
||||||
this.version = version;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see OperatingSystemSection#getDescription
|
|
||||||
*/
|
|
||||||
public Builder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public OperatingSystemSection build() {
|
|
||||||
return new OperatingSystemSection(info, id, version, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromOperatingSystemSection(OperatingSystemSection in) {
|
|
||||||
return id(in.getId()).info(in.getInfo()).description(in.getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<OperatingSystemSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
protected Integer id;
|
|
||||||
@XmlAttribute
|
|
||||||
protected String version;
|
|
||||||
@XmlElement
|
|
||||||
protected String description;
|
|
||||||
|
|
||||||
public OperatingSystemSection(@Nullable String info, @Nullable Integer id, @Nullable String version, @Nullable String description) {
|
|
||||||
super(info);
|
|
||||||
this.id = id;
|
|
||||||
this.description = description;
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OperatingSystemSection() {
|
|
||||||
// For Builders and JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return ovf id
|
|
||||||
* @see org.jclouds.vcloud.director.v1_5.cim.OSType#getCode()
|
|
||||||
*/
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return description or null
|
|
||||||
*/
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
OperatingSystemSection other = (OperatingSystemSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(description, other.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("description", description);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,140 +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.ovf;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ProductSection element specifies product-information for an appliance, such as product name,
|
|
||||||
* version, and vendor.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "ProductSection", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class ProductSection extends SectionType<ProductSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromDeploymentOptionSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<ProductSection> {
|
|
||||||
protected Set<org.jclouds.vcloud.director.v1_5.ovf.Property> properties = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ProductSection#getProperties
|
|
||||||
*/
|
|
||||||
public Builder property(org.jclouds.vcloud.director.v1_5.ovf.Property property) {
|
|
||||||
this.properties.add(checkNotNull(property, "property"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ProductSection#getProperties
|
|
||||||
*/
|
|
||||||
public Builder properties(Iterable<org.jclouds.vcloud.director.v1_5.ovf.Property> properties) {
|
|
||||||
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.ovf.Property> copyOf(checkNotNull(properties, "properties"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ProductSection build() {
|
|
||||||
return new ProductSection(info, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromDeploymentOptionSection(ProductSection in) {
|
|
||||||
return info(in.getInfo()).properties(in.getProperties());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<ProductSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Set<org.jclouds.vcloud.director.v1_5.ovf.Property> properties;
|
|
||||||
|
|
||||||
private ProductSection(String info, Iterable<org.jclouds.vcloud.director.v1_5.ovf.Property> properties) {
|
|
||||||
super(info);
|
|
||||||
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.ovf.Property> copyOf(checkNotNull(properties, "properties"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProductSection() {
|
|
||||||
// For JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (!super.equals(obj)) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
ProductSection other = (ProductSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(properties, other.properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("properties", properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<org.jclouds.vcloud.director.v1_5.ovf.Property> getProperties() {
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,146 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "Property", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class Property {
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
protected String key;
|
|
||||||
protected String value;
|
|
||||||
protected String label;
|
|
||||||
protected String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Property#getKey
|
|
||||||
*/
|
|
||||||
public Builder key(String key) {
|
|
||||||
this.key = key;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Property#getValue
|
|
||||||
*/
|
|
||||||
public Builder value(String value) {
|
|
||||||
this.value = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Property#getLabel
|
|
||||||
*/
|
|
||||||
public Builder label(String label) {
|
|
||||||
this.label = label;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Property#getDescription
|
|
||||||
*/
|
|
||||||
public Builder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Property build() {
|
|
||||||
return new Property(key, value, label, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromProperty(Property in) {
|
|
||||||
return key(in.getKey()).value(in.getValue()).description(in.getDescription()).label(in.getLabel());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
private String value;
|
|
||||||
private String label;
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
private Property(String key, String value, String label, String description) {
|
|
||||||
this.key = key;
|
|
||||||
this.value = value;
|
|
||||||
this.label = label;
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Property() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((key == null) ? 0 : key.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;
|
|
||||||
Property other = (Property) obj;
|
|
||||||
if (key == null) {
|
|
||||||
if (other.key != null)
|
|
||||||
return false;
|
|
||||||
} else if (!key.equals(other.key))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("[key=%s, value=%s, label=%s, description=%s]", key, value, label, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,127 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Metadata about a virtual machine or grouping of them.
|
|
||||||
* <p/>
|
|
||||||
* Base type for Sections, subclassing this is the most common form of extensibility. Subtypes define more specific
|
|
||||||
* elements.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO why do I have to declare these?
|
|
||||||
@XmlSeeAlso(
|
|
||||||
{CustomizationSection.class,
|
|
||||||
DeploymentOptionSection.class,
|
|
||||||
DiskSection.class,
|
|
||||||
LeaseSettingsSection.class,
|
|
||||||
GuestCustomizationSection.class,
|
|
||||||
NetworkSection.class,
|
|
||||||
NetworkConfigSection.class,
|
|
||||||
NetworkConnectionSection.class,
|
|
||||||
ProductSection.class,
|
|
||||||
VirtualHardwareSection.class,
|
|
||||||
VirtualSystem.class })
|
|
||||||
public abstract class SectionType<T extends SectionType<T>> {
|
|
||||||
|
|
||||||
public abstract Builder<T> toBuilder();
|
|
||||||
|
|
||||||
public static abstract class Builder<T extends SectionType<T>> {
|
|
||||||
protected String info;
|
|
||||||
|
|
||||||
public abstract SectionType<T> build();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SectionType#getInfo
|
|
||||||
*/
|
|
||||||
public Builder<T> info(String info) {
|
|
||||||
this.info = info;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder<T> fromSection(SectionType<T> in) {
|
|
||||||
return info(in.getInfo());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlElement(name = "Info", namespace = VCLOUD_OVF_NS)
|
|
||||||
protected String info;
|
|
||||||
|
|
||||||
public SectionType(@Nullable String info) {
|
|
||||||
this.info = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SectionType() {
|
|
||||||
// For Builders and JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Info element describes the meaning of the Section, this is typically shown if the Section is not understood by an
|
|
||||||
* application
|
|
||||||
*
|
|
||||||
* @return ovf info
|
|
||||||
*/
|
|
||||||
public String getInfo() {
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
SectionType<?> other = (SectionType<?>) obj;
|
|
||||||
return Objects.equal(info, other.info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return string().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return Objects.toStringHelper("").add("info", info);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,206 +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.ovf;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.cim.ResourceAllocationSettingData;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.cim.VirtualSystemSettingData;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The virtual hardware required by a virtual machine is specified in VirtualHardwareSection.
|
|
||||||
* <p/>
|
|
||||||
* This specification supports abstract or incomplete hardware descriptions in which only the major
|
|
||||||
* devices are described. The hypervisor is allowed to create additional virtual hardware
|
|
||||||
* controllers and devices, as long as the required devices listed in the descriptor are realized.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class VirtualHardwareSection extends SectionType<VirtualHardwareSection> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromVirtualHardwareSection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends SectionType.Builder<VirtualHardwareSection> {
|
|
||||||
protected VirtualSystemSettingData virtualSystem;
|
|
||||||
protected Set<String> transports = Sets.newLinkedHashSet();
|
|
||||||
protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualHardwareSection#getSystem
|
|
||||||
*/
|
|
||||||
public Builder system(VirtualSystemSettingData virtualSystem) {
|
|
||||||
this.virtualSystem = virtualSystem;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualHardwareSection#getTransports
|
|
||||||
*/
|
|
||||||
public Builder transport(String transport) {
|
|
||||||
this.transports.add(checkNotNull(transport, "transport"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualHardwareSection#getTransports
|
|
||||||
*/
|
|
||||||
public Builder transports(Iterable<String> transports) {
|
|
||||||
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualHardwareSection#getItems
|
|
||||||
*/
|
|
||||||
public Builder item(ResourceAllocationSettingData item) {
|
|
||||||
this.items.add(checkNotNull(item, "item"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualHardwareSection#getItems
|
|
||||||
*/
|
|
||||||
public Builder items(Iterable<? extends ResourceAllocationSettingData> items) {
|
|
||||||
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(
|
|
||||||
items, "items"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VirtualHardwareSection build() {
|
|
||||||
return new VirtualHardwareSection(info, transports, virtualSystem, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
|
|
||||||
return fromSection(in).items(in.getItems()).transports(in.getTransports()).system(
|
|
||||||
in.getSystem()).info(in.getInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<VirtualHardwareSection> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private VirtualSystemSettingData virtualSystem;
|
|
||||||
private Set<String> transports;
|
|
||||||
private Set<ResourceAllocationSettingData> items;
|
|
||||||
|
|
||||||
private VirtualHardwareSection(String info, Iterable<String> transports, VirtualSystemSettingData virtualSystem,
|
|
||||||
Iterable<? extends ResourceAllocationSettingData> items) {
|
|
||||||
super(info);
|
|
||||||
this.virtualSystem = virtualSystem;
|
|
||||||
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
|
|
||||||
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(items, "items"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private VirtualHardwareSection() {
|
|
||||||
// For JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* transport types define methods by which the environment document is communicated from the
|
|
||||||
* deployment platform to the guest software.
|
|
||||||
* <p/>
|
|
||||||
* 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
|
|
||||||
* communicates the environment 1346 document by making a dynamically generated ISO image
|
|
||||||
* available to the guest software. To support the iso transport type, prior to booting a virtual
|
|
||||||
* 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
|
|
||||||
* least one disconnected CD-ROM device shall be present in this section.
|
|
||||||
* <p/>
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set<String> getTransports() {
|
|
||||||
return transports;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VirtualSystemSettingData getSystem() {
|
|
||||||
return virtualSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<? extends ResourceAllocationSettingData> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), transports, virtualSystem, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
VirtualHardwareSection other = (VirtualHardwareSection) obj;
|
|
||||||
return super.equals(other) && Objects.equal(transports, other.transports)
|
|
||||||
&& Objects.equal(virtualSystem, other.virtualSystem)
|
|
||||||
&& Objects.equal(items, other.items);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return super.string().add("transports", transports).add("virtualSystem", virtualSystem).add("items", items);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,166 +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.ovf;
|
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.internal.BaseVirtualSystem;
|
|
||||||
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @author Adam Lowe
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "VirtualSystem", namespace = VCLOUD_OVF_NS)
|
|
||||||
public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
|
|
||||||
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return new Builder().fromVirtualSystem(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends BaseVirtualSystem.Builder<VirtualSystem> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VirtualSystem build() {
|
|
||||||
return new VirtualSystem(id, info, name, operatingSystem, virtualHardwareSections, productSections,
|
|
||||||
additionalSections);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public Builder additionalSection(String name, SectionType additionalSection) {
|
|
||||||
return Builder.class.cast(super.additionalSection(name, additionalSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public Builder additionalSections(Multimap<String, SectionType> additionalSections) {
|
|
||||||
return Builder.class.cast(super.additionalSections(additionalSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromSection(SectionType<VirtualSystem> in) {
|
|
||||||
return Builder.class.cast(super.fromSection(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder fromVirtualSystem(BaseVirtualSystem<VirtualSystem> in) {
|
|
||||||
return Builder.class.cast(super.fromVirtualSystem(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) {
|
|
||||||
return Builder.class.cast(super.virtualHardwareSection(virtualHardwareSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder virtualHardwareSections(Iterable<? extends VirtualHardwareSection> virtualHardwareSections) {
|
|
||||||
return Builder.class.cast(super.virtualHardwareSections(virtualHardwareSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder id(String id) {
|
|
||||||
return Builder.class.cast(super.id(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder info(String info) {
|
|
||||||
return Builder.class.cast(super.info(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder name(String name) {
|
|
||||||
return Builder.class.cast(super.name(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder operatingSystemSection(OperatingSystemSection operatingSystem) {
|
|
||||||
return Builder.class.cast(super.operatingSystemSection(operatingSystem));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder productSection(ProductSection productSection) {
|
|
||||||
return Builder.class.cast(super.productSection(productSection));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder productSections(Iterable<? extends ProductSection> productSections) {
|
|
||||||
return Builder.class.cast(super.productSections(productSections));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private VirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
|
|
||||||
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
|
|
||||||
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
|
|
||||||
super(id, info, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
|
|
||||||
}
|
|
||||||
|
|
||||||
private VirtualSystem() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,188 +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.ovf.internal;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.DiskSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.NetworkSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.SectionType;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.LinkedHashMultimap;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public abstract class BaseEnvelope<V extends BaseVirtualSystem<V>, E extends BaseEnvelope<V, E>> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public abstract Builder<V, E> toBuilder();
|
|
||||||
|
|
||||||
public static abstract class Builder<V extends BaseVirtualSystem<V>, E extends BaseEnvelope<V, E>> {
|
|
||||||
protected Set<DiskSection> diskSections = Sets.newLinkedHashSet();
|
|
||||||
protected Set<NetworkSection> networkSections = Sets.newLinkedHashSet();
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected Multimap<String, SectionType> additionalSections = LinkedHashMultimap.create();
|
|
||||||
protected V virtualSystem;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getDiskSections
|
|
||||||
*/
|
|
||||||
public Builder<V, E> diskSection(DiskSection diskSection) {
|
|
||||||
this.diskSections.add(checkNotNull(diskSection, "diskSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getDiskSections
|
|
||||||
*/
|
|
||||||
public Builder<V, E> diskSections(Iterable<? extends DiskSection> diskSections) {
|
|
||||||
this.diskSections = ImmutableSet.<DiskSection> copyOf(checkNotNull(diskSections, "diskSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getNetworkSections
|
|
||||||
*/
|
|
||||||
public Builder<V, E> networkSection(NetworkSection networkSection) {
|
|
||||||
this.networkSections.add(checkNotNull(networkSection, "networkSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getNetworkSections
|
|
||||||
*/
|
|
||||||
public Builder<V, E> networkSections(Iterable<? extends NetworkSection> networkSections) {
|
|
||||||
this.networkSections = ImmutableSet.<NetworkSection> copyOf(checkNotNull(networkSections, "networkSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getAdditionalSections
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Builder<V, E> additionalSection(String name, SectionType additionalSection) {
|
|
||||||
this.additionalSections.put(checkNotNull(name, "name"), checkNotNull(additionalSection, "additionalSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getAdditionalSections
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Builder<V, E> additionalSections(Multimap<String, SectionType> additionalSections) {
|
|
||||||
this.additionalSections = ImmutableMultimap.<String, SectionType> copyOf(checkNotNull(additionalSections,
|
|
||||||
"additionalSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseEnvelope#getVirtualSystem
|
|
||||||
*/
|
|
||||||
public Builder<V, E> virtualSystem(V virtualSystem) {
|
|
||||||
this.virtualSystem = virtualSystem;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public abstract E build() ;
|
|
||||||
|
|
||||||
public Builder<V, E> fromEnvelope(BaseEnvelope<V, E> in) {
|
|
||||||
return virtualSystem(in.getVirtualSystem()).diskSections(in.getDiskSections())
|
|
||||||
.networkSections(networkSections).additionalSections(in.getAdditionalSections());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<DiskSection> diskSections;
|
|
||||||
private Set<NetworkSection> networkSections;
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Multimap<String, SectionType> additionalSections;
|
|
||||||
private V virtualSystem;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected BaseEnvelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections,
|
|
||||||
Multimap<String, SectionType> additionalSections, V virtualSystem) {
|
|
||||||
this.diskSections = ImmutableSet.copyOf(checkNotNull(diskSections, "diskSections"));
|
|
||||||
this.networkSections = ImmutableSet.copyOf(checkNotNull(networkSections, "networkSections"));
|
|
||||||
this.additionalSections = ImmutableMultimap.copyOf(checkNotNull(additionalSections, "additionalSections"));
|
|
||||||
this.virtualSystem = checkNotNull(virtualSystem, "virtualSystem");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected BaseEnvelope() {
|
|
||||||
// for JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
public V getVirtualSystem() {
|
|
||||||
return virtualSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<? extends DiskSection> getDiskSections() {
|
|
||||||
return diskSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Multimap<String, SectionType> getAdditionalSections() {
|
|
||||||
return additionalSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(additionalSections, diskSections, networkSections, virtualSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
BaseEnvelope<?, ?> other = (BaseEnvelope<?, ?>) obj;
|
|
||||||
return Objects.equal(additionalSections, other.additionalSections)
|
|
||||||
&& Objects.equal(diskSections, other.diskSections)
|
|
||||||
&& Objects.equal(networkSections, other.networkSections)
|
|
||||||
&& Objects.equal(virtualSystem, other.virtualSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return string().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return Objects.toStringHelper("").add("diskSections", diskSections).add("networkSections", networkSections)
|
|
||||||
.add("additionalSections", additionalSections).add("virtualSystem", virtualSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<NetworkSection> getNetworkSections() {
|
|
||||||
return networkSections;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,249 +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.ovf.internal;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.OperatingSystemSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.ProductSection;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.SectionType;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.ovf.VirtualHardwareSection;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.LinkedHashMultimap;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends SectionType<T> {
|
|
||||||
|
|
||||||
public static abstract class Builder<T extends BaseVirtualSystem<T>> extends SectionType.Builder<T> {
|
|
||||||
protected String id;
|
|
||||||
protected String name;
|
|
||||||
protected OperatingSystemSection operatingSystem;
|
|
||||||
protected Set<VirtualHardwareSection> virtualHardwareSections = Sets.newLinkedHashSet();
|
|
||||||
protected Set<ProductSection> productSections = Sets.newLinkedHashSet();
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected Multimap<String, SectionType> additionalSections = LinkedHashMultimap.create();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getName
|
|
||||||
*/
|
|
||||||
public Builder<T> name(String name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getId
|
|
||||||
*/
|
|
||||||
public Builder<T> id(String id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getOperatingSystemSection
|
|
||||||
*/
|
|
||||||
public Builder<T> operatingSystemSection(OperatingSystemSection operatingSystem) {
|
|
||||||
this.operatingSystem = operatingSystem;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getVirtualHardwareSections
|
|
||||||
*/
|
|
||||||
public Builder<T> virtualHardwareSection(VirtualHardwareSection virtualHardwareSection) {
|
|
||||||
this.virtualHardwareSections.add(checkNotNull(virtualHardwareSection, "virtualHardwareSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getVirtualHardwareSections
|
|
||||||
*/
|
|
||||||
public Builder<T> virtualHardwareSections(Iterable<? extends VirtualHardwareSection> virtualHardwareSections) {
|
|
||||||
this.virtualHardwareSections = ImmutableSet.<VirtualHardwareSection> copyOf(checkNotNull(virtualHardwareSections,
|
|
||||||
"virtualHardwareSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getProductSections
|
|
||||||
*/
|
|
||||||
public Builder<T> productSection(ProductSection productSection) {
|
|
||||||
this.productSections.add(checkNotNull(productSection, "productSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getProductSections
|
|
||||||
*/
|
|
||||||
public Builder<T> productSections(Iterable<? extends ProductSection> productSections) {
|
|
||||||
this.productSections = ImmutableSet.<ProductSection> copyOf(checkNotNull(productSections, "productSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getAdditionalSections
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Builder<T> additionalSection(String name, SectionType additionalSection) {
|
|
||||||
this.additionalSections.put(checkNotNull(name, "name"), checkNotNull(additionalSection, "additionalSection"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see BaseVirtualSystem#getAdditionalSections
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Builder<T> additionalSections(Multimap<String, SectionType> additionalSections) {
|
|
||||||
this.additionalSections = ImmutableMultimap.<String, SectionType> copyOf(checkNotNull(additionalSections,
|
|
||||||
"additionalSections"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public abstract BaseVirtualSystem<T> build();
|
|
||||||
|
|
||||||
public Builder<T> fromVirtualSystem(BaseVirtualSystem<T> in) {
|
|
||||||
return fromSection(in).id(in.getId()).name(in.getName())
|
|
||||||
.operatingSystemSection(in.getOperatingSystemSection()).virtualHardwareSections(
|
|
||||||
in.getVirtualHardwareSections()).productSections(in.getProductSections())
|
|
||||||
.additionalSections(in.getAdditionalSections());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder<T> fromSection(SectionType<T> in) {
|
|
||||||
return (Builder<T>) super.fromSection(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Builder<T> info(String info) {
|
|
||||||
return (Builder<T>) super.info(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
private OperatingSystemSection operatingSystem;
|
|
||||||
private Set<VirtualHardwareSection> virtualHardwareSections;
|
|
||||||
private Set<ProductSection> productSections;
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Multimap<String, SectionType> additionalSections;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected BaseVirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
|
|
||||||
Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
|
|
||||||
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
|
|
||||||
super(info);
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
|
|
||||||
this.virtualHardwareSections = ImmutableSet.copyOf(checkNotNull(virtualHardwareSections, "virtualHardwareSections"));
|
|
||||||
this.productSections = ImmutableSet.copyOf(checkNotNull(productSections, "productSections"));
|
|
||||||
this.additionalSections = ImmutableMultimap.copyOf(checkNotNull(additionalSections, "additionalSections"));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected BaseVirtualSystem() {
|
|
||||||
// For JAXB
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OperatingSystemSection getOperatingSystemSection() {
|
|
||||||
return operatingSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Each VirtualSystem element may contain one or more VirtualHardwareSection elements, each of
|
|
||||||
* which describes the virtual virtualHardwareSections required by the virtual system.
|
|
||||||
*/
|
|
||||||
public Set<? extends VirtualHardwareSection> getVirtualHardwareSections() {
|
|
||||||
return virtualHardwareSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies product-information for a package, such as product name and version, along with a
|
|
||||||
* set of properties that can be configured
|
|
||||||
*/
|
|
||||||
public Set<? extends ProductSection> getProductSections() {
|
|
||||||
return productSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Multimap<String, SectionType> getAdditionalSections() {
|
|
||||||
return additionalSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(id, name, info, operatingSystem, virtualHardwareSections, productSections, additionalSections);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null) return false;
|
|
||||||
if (getClass() != obj.getClass()) return false;
|
|
||||||
|
|
||||||
BaseVirtualSystem<?> other = (BaseVirtualSystem<?>) obj;
|
|
||||||
return Objects.equal(id, other.id)
|
|
||||||
&& Objects.equal(name, other.name)
|
|
||||||
&& Objects.equal(info, other.info)
|
|
||||||
&& Objects.equal(operatingSystem, other.operatingSystem)
|
|
||||||
&& Objects.equal(virtualHardwareSections, other.virtualHardwareSections)
|
|
||||||
&& Objects.equal(productSections, other.productSections)
|
|
||||||
&& Objects.equal(additionalSections, other.additionalSections);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return string().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Objects.ToStringHelper string() {
|
|
||||||
return Objects.toStringHelper("").add("id", id).add("name", name).add("info", info)
|
|
||||||
.add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections)
|
|
||||||
.add("productSections", productSections).add("additionalSections", additionalSections)
|
|
||||||
.add("additionalSections", additionalSections);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +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.ovf;
|
|
||||||
|
|
Loading…
Reference in New Issue