http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java deleted file mode 100644 index 930bc43..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Objects; - -/** - * Name: en1: Wi-Fi (AirPort) GUID: 00316e65-0000-4000-8000-28cfdaf2917a Dhcp: - * Disabled IPAddress: 192.168.57.1 NetworkMask: 255.255.255.0 IPV6Address: - * IPV6NetworkMaskPrefixLength: 0 HardwareAddress: 28:cf:da:f2:91:7a MediumType: - * Ethernet Status: Up VBoxNetworkName: HostInterfaceNetworking-en1: Wi-Fi - * (AirPort) - */ -public class BridgedIf { - - private final String name; - private final String guid; - private final String dhcp; - private final String ipAddress; - private final String networkMask; - private final String ipv6Address; - private final String ipv6NetworkMask; - private final String mediumType; - private final String status; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String name; - private String guid; - private String dhcp; - private String ipAddress; - private String networkMask; - private String ipv6Address; - private String iv6NetworkMask; - private String mediumType; - private String status; - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder guid(String guid) { - this.guid = guid; - return this; - } - - public Builder dhcp(String dhcp) { - this.dhcp = dhcp; - return this; - } - - public Builder ip(String ipAddress) { - this.ipAddress = ipAddress; - return this; - } - - public Builder networkMask(String networkMask) { - this.networkMask = networkMask; - return this; - } - - public Builder ipv6(String ipv6Address) { - this.ipv6Address = ipv6Address; - return this; - } - - public Builder ipv6networkMask(String iv6NetworkMask) { - this.iv6NetworkMask = iv6NetworkMask; - return this; - } - - public Builder mediumType(String mediumType) { - this.mediumType = mediumType; - return this; - } - - public Builder status(String status) { - this.status = status; - return this; - } - - public BridgedIf build() { - return new BridgedIf(name, guid, dhcp, ipAddress, networkMask, - ipv6Address, iv6NetworkMask, mediumType, status); - } - } - - public BridgedIf(String name, String guid, String dhcp, String ipAddress, - String networkMask, String ipv6Address, String iv6NetworkMask, - String mediumType, String status) { - this.name = checkNotNull(name, "bridgedIf name can't be null"); - this.guid = guid; - this.dhcp = dhcp; - this.ipAddress = checkNotNull(ipAddress, "bridgedIf ipAddress can't be null"); - this.networkMask = networkMask; - this.ipv6Address = ipv6Address; - this.ipv6NetworkMask = iv6NetworkMask; - this.mediumType = mediumType; - this.status = checkNotNull(status, "bridgedIf status can't be null"); - } - - public String getName() { - return name; - } - - public String getGuid() { - return guid; - } - - public String getDhcp() { - return dhcp; - } - - public String getIpAddress() { - return ipAddress; - } - - public String getNetworkMask() { - return networkMask; - } - - public String getIpv6Address() { - return ipv6Address; - } - - public String getIpv6NetworkMask() { - return ipv6NetworkMask; - } - - public String getMediumType() { - return mediumType; - } - - public String getStatus() { - return status; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof BridgedIf) { - BridgedIf other = (BridgedIf) o; - return Objects.equal(name, other.name) - && Objects.equal(dhcp, other.dhcp) - && Objects.equal(ipAddress, other.ipAddress) - && Objects.equal(networkMask, other.networkMask) - && Objects.equal(mediumType, other.mediumType) - && Objects.equal(status, other.status); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, guid, dhcp, ipAddress, networkMask, ipv6Address, ipv6NetworkMask, mediumType, status); - } - - @Override - public String toString() { - return "BridgedIf{" + - "name=" + name + - ", dhcp=" + dhcp + - ", ipAddress=" + ipAddress + - ", networkMask=" + networkMask + - ", ipv6Address=" + ipv6Address + - ", ipv6NetworkMask=" + ipv6NetworkMask + - ", mediumType=" + mediumType + - ", status=" + status + - '}'; - } - -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java deleted file mode 100644 index 477e0ba..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.virtualbox_4_2.IMachine; - -import com.google.common.base.Objects; - -/** - * A complete specification of a "clone" node with networking setup and the physical machine - * specification. - */ -public class CloneSpec { - - private final VmSpec vmSpec; - private final NetworkSpec networkSpec; - private final IMachine master; - private final boolean isLinked; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private VmSpec vmSpec; - private NetworkSpec networkSpec; - private IMachine master; - private boolean isLinked; - - public Builder vm(VmSpec vmSpec) { - this.vmSpec = vmSpec; - return this; - } - - public Builder network(NetworkSpec networkSpec) { - this.networkSpec = networkSpec; - return this; - } - - public Builder master(IMachine master) { - this.master = master; - return this; - } - - public Builder linked(boolean isLinked) { - this.isLinked = isLinked; - return this; - } - - public CloneSpec build() { - return new CloneSpec(vmSpec, networkSpec, master, isLinked); - } - - } - - public CloneSpec(VmSpec vmSpec, NetworkSpec networkSpec, IMachine master, boolean isLinked) { - this.vmSpec = checkNotNull(vmSpec, "vmSpec can't be null"); - this.networkSpec = checkNotNull(networkSpec, "networkSpec can't be null"); - this.master = checkNotNull(master, "master can't be null"); - this.isLinked = isLinked; - } - - public VmSpec getVmSpec() { - return vmSpec; - } - - public NetworkSpec getNetworkSpec() { - return networkSpec; - } - - public IMachine getMaster() { - return master; - } - - public boolean isLinked() { - return isLinked; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof CloneSpec) { - CloneSpec other = (CloneSpec) o; - return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(networkSpec, other.networkSpec); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(vmSpec, networkSpec); - } - - @Override - public String toString() { - return "CloneSpec{" + "vmSpec= " + vmSpec + ", networkSpec= " + networkSpec + '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java deleted file mode 100644 index b345214..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.virtualbox_4_2.DeviceType; - -import com.google.common.base.Objects; - -/** - * Represents a specification for a device attachment. - * <p/> - * <p/> - * From the VirtualBox SDK: - * <p/> - * port: - * For an IDE controller, 0 specifies the primary controller and 1 specifies the secondary controller. - * For a SCSI controller, this must range from 0 to 15; for a SATA controller, from 0 to 29; for an SAS controller, - * from 0 to 7 - */ -public class DeviceDetails { - - private final int port; - private final int deviceSlot; - private final DeviceType deviceType; - - public DeviceDetails(int port, int deviceSlot, DeviceType deviceType) { - this.port = port; - this.deviceSlot = deviceSlot; - this.deviceType = checkNotNull(deviceType, "deviceType can't be null"); - } - - public int getPort() { - return port; - } - - public int getDeviceSlot() { - return deviceSlot; - } - - public DeviceType getDeviceType() { - return deviceType; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private int port; - private int deviceSlot; - private DeviceType deviceType; - - public Builder port(int port) { - this.port = port; - return this; - } - - public Builder deviceType(DeviceType deviceType) { - this.deviceType = deviceType; - return this; - } - - public Builder deviceSlot(int slot) { - this.deviceSlot = slot; - return this; - } - - public DeviceDetails build() { - checkNotNull(deviceType, "deviceType can't be null"); - return new DeviceDetails(port, deviceSlot, deviceType); - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof DeviceDetails) { - DeviceDetails other = (DeviceDetails) o; - return Objects.equal(port, other.port) && - Objects.equal(deviceSlot, other.deviceSlot) - && Objects.equal(deviceType, other.deviceType); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(port, deviceSlot, deviceType); - } - - @Override - public String toString() { - return "DeviceDetails{" + - "port=" + port + - ", deviceSlot=" + deviceSlot + - ", deviceType=" + deviceType + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java deleted file mode 100644 index d43d518..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import java.util.Map; - -import org.virtualbox_4_2.VBoxException; -import org.virtualbox_4_2.jaxws.RuntimeFaultMsg; - -import com.google.common.collect.ImmutableMap; - -/** - * Maps the error codes in the Virtual Box Java API into enum values. - * <p/> - * <p/> - * To get the error code from a VBoxException, use: - * - * <pre> - * try { - * ... - * ... - * } - * catch (VBoxException vboxException) { - * RuntimeFaultMsg fault = (RuntimeFaultMsg) vboxException.getWrapped(); - * int faultCode = fault.getFaultInfo().getResultCode(); - * ErrorCode errorCode = ErrorCode.valueOf(faultCode); - * } - * </pre> - */ -public enum ErrorCode { - - VBOX_E_OBJECT_NOT_FOUND(2159738881L), - VBOX_E_INVALID_VM_STATE(2159738882L), - VBOX_E_VM_ERROR(2159738883L), - VBOX_E_FILE_ERROR(2159738884L), - VBOX_E_IPRT_ERROR(2159738885L), - VBOX_E_PDM_ERROR(2159738886L), - VBOX_E_INVALID_OBJECT_STATE(2159738887L), - VBOX_E_HOST_ERROR(2159738888L), - VBOX_E_NOT_SUPPORTED(2159738889L), - VBOX_E_XML_ERROR(2159738890L), - VBOX_E_INVALID_SESSION_STATE(2159738891L), - VBOX_E_OBJECT_IN_USE(2159738892L), - VBOX_E_ACCESSDENIED(2147942405L), - VBOX_E_POINTER(2147500035L), - VBOX_E_FAIL(2147500037L), - VBOX_E_NOTIMPL(2147500033L), - VBOX_E_OUTOFMEMORY(2147942414L), - VBOX_E_INVALIDARG(2147942487L), - VBOX_E_UNEXPECTED(2147549183L), - VBOX_E_UNKNOWN_ERROR_CODE(-1L), - VBOX_E_ERROR_CODE_UNAVAILABLE(-2L); - - private final long code; - - ErrorCode(long code) { - this.code = code; - } - - private static final Map<Long, ErrorCode> TABLE; - static { - ImmutableMap.Builder<Long, ErrorCode> builder = ImmutableMap.builder(); - for (ErrorCode errorCode : ErrorCode.values()) { - builder.put(errorCode.code, errorCode); - } - TABLE = builder.build(); - } - - /** - * Returns an ErrorCode from the fault code given by the VirtualBox API. - * - * @param vboxException - * the exception to get the error code from. - * @return an ErrorCode representing the given fault code. - */ - public static ErrorCode valueOf(VBoxException vboxException) { - final Throwable backend = vboxException.getWrapped(); - if (backend instanceof RuntimeFaultMsg) { - final RuntimeFaultMsg faultCode = (RuntimeFaultMsg) backend; - final int resultCode = faultCode.getFaultInfo().getResultCode(); - final ErrorCode errorCode = TABLE.get(unsignedIntToLong(resultCode)); - if (errorCode != null) { - return errorCode; - } - return VBOX_E_UNKNOWN_ERROR_CODE; - } - return VBOX_E_ERROR_CODE_UNAVAILABLE; - } - - private static long unsignedIntToLong(int faultCode) { - return faultCode & 0xffffffffL; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java deleted file mode 100644 index 8e66911..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -public enum ExecutionType { - - GUI("gui"), HEADLESS("headless"), SDL("sdl"), EMERGENCYSTOP("emergencystop"); - - private final String type; - - ExecutionType(String type) { - this.type = type; - } - - public String stringValue() { - return type; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java deleted file mode 100644 index bf7aa85..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.virtualbox_4_2.DeviceType; - -import com.google.common.base.Objects; - -/** - * A representation of a hard disk in a VirtualBox VM. - * <p/> - * name is a description to identify the hard disk. - * diskPath is an absolute path to the file that is the location of the storage for the hard disk. - * diskFormat is any of the formats supported by ISystemProperties.getMediumFormats() in the VirtualBox API. - * This call is platform-dependent so the supported formats differ from host to host. The default format used is VDI. - * deviceDetails contains information about how the HardDisk is attached to the StorageController. - */ -public class HardDisk { - - public static final String DEFAULT_DISK_FORMAT = "vdi"; - - // NB the name is not independent; the IMedium name is chosen based on the last part of diskPath - private final String name; - private final String diskFormat; - private final String diskPath; - private final DeviceDetails deviceDetails; - private final boolean autoDelete; - - public HardDisk(DeviceDetails deviceDetails, String diskPath, String diskFormat, boolean autoDelete) { - this.diskPath = checkNotNull(diskPath, "diskPath can't be null"); - this.diskFormat = checkNotNull(diskFormat, "diskFormat can't be null"); - this.deviceDetails = checkNotNull(deviceDetails, "deviceDetails can't be null"); - this.name = diskPath.substring(diskPath.lastIndexOf("/") + 1); - this.autoDelete = autoDelete; - } - - public String getDiskPath() { - return diskPath; - } - - public String getDiskFormat() { - return diskFormat; - } - - public DeviceDetails getDeviceDetails() { - return deviceDetails; - } - - public String getName() { - return name; - } - - public boolean isAutoDelete() { - return autoDelete; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof HardDisk) { - HardDisk hardDisk = (HardDisk) o; - return Objects.equal(deviceDetails, hardDisk.deviceDetails) && - Objects.equal(diskFormat, hardDisk.diskFormat) && - Objects.equal(diskPath, hardDisk.diskPath) && - Objects.equal(name, hardDisk.name); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(diskPath, diskFormat, deviceDetails, name); - } - - @Override - public String toString() { - return "HardDisk{" + - "diskFormat='" + diskFormat + '\'' + - ", diskPath='" + diskPath + '\'' + - ", deviceDetails=" + deviceDetails + - ", name=" + name + - '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String diskFormat = "vdi"; - private String diskPath; - private int controllerPort; - private int deviceSlot; - private DeviceType deviceType = DeviceType.HardDisk; - private boolean autoDelete = false; - - public Builder diskFormat(String diskFormat) { - this.diskFormat = diskFormat; - return this; - } - - public Builder diskpath(String diskPath) { - this.diskPath = diskPath; - return this; - } - - public Builder controllerPort(int controllerPort) { - this.controllerPort = controllerPort; - return this; - } - - public Builder deviceSlot(int deviceSlot) { - this.deviceSlot = deviceSlot; - return this; - } - - public Builder autoDelete(boolean autoDelete) { - this.autoDelete = autoDelete; - return this; - } - - public HardDisk build() { - checkNotNull(diskPath); - checkNotNull(controllerPort); - checkNotNull(deviceSlot); - return new HardDisk(new DeviceDetails(controllerPort, deviceSlot, deviceType), diskPath, diskFormat, autoDelete); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java deleted file mode 100644 index 48df283..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Objects; - -/** - * Represents an optical medium (DVD) in a VirtualBox VM. - * <p/> - * sourcePath is the location of the .iso file to load the medium from. - * deviceDetails contains information about how the Dvd is attached to the StorageController. - */ -public class IsoImage { - private DeviceDetails deviceDetails; - private String sourcePath; - - public IsoImage(DeviceDetails deviceDetails, String sourcePath) { - this.deviceDetails = checkNotNull(deviceDetails, "deviceDetails can't be null"); - this.sourcePath = checkNotNull(sourcePath, "sourcePath can't be null"); - } - - public DeviceDetails getDeviceDetails() { - return deviceDetails; - } - - public String getSourcePath() { - return sourcePath; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof IsoImage) { - IsoImage other = (IsoImage) o; - return Objects.equal(deviceDetails, other.deviceDetails) && - Objects.equal(sourcePath, other.sourcePath); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(deviceDetails, sourcePath); - } - - @Override - public String toString() { - return "Dvd{" + - "deviceDetails=" + deviceDetails + - ", sourcePath='" + sourcePath + '\'' + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java deleted file mode 100644 index daf6af0..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Objects; - -/** - * The information needed to create a machine from a .iso file. - */ -public class IsoSpec { - - private final String installationKeySequence; - private final String sourcePath; - - public IsoSpec(String sourcePath, String installationKeySequence) { - this.sourcePath = checkNotNull(sourcePath, "sourcePath can't be null"); - this.installationKeySequence = checkNotNull(installationKeySequence, "installationKeySequence can't be null"); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String installationSequence; - private String sourcePath; - - public Builder installationScript(String installationSequence) { - this.installationSequence = installationSequence; - return this; - } - - public Builder sourcePath(String sourcePath) { - this.sourcePath = sourcePath; - return this; - } - - - public IsoSpec build() { - return new IsoSpec(sourcePath, installationSequence); - } - } - - public String getInstallationKeySequence() { - return installationKeySequence; - } - - public String getSourcePath() { - return sourcePath; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof IsoSpec) { - IsoSpec other = (IsoSpec) o; - return Objects.equal(sourcePath, other.sourcePath) && - Objects.equal(installationKeySequence, other.installationKeySequence); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(sourcePath, installationKeySequence); - } - - @Override - public String toString() { - return "IsoSpec{" + - "sourcePath='" + sourcePath + '\'' + - "installationKeySequence='" + installationKeySequence + '\'' + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java deleted file mode 100644 index a8261ae..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import org.virtualbox_4_2.IMachine; - -public class Master { - - private final IMachine machine; - private final MasterSpec spec; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private IMachine machine; - private MasterSpec spec; - - public Builder machine(IMachine machine) { - this.machine = machine; - return this; - } - - public Builder spec(MasterSpec spec) { - this.spec = spec; - return this; - } - - public Master build() { - return new Master(machine, spec); - } - - } - - private Master(IMachine machine, MasterSpec spec) { - super(); - this.machine = machine; - this.spec = spec; - } - - public IMachine getMachine() { - return machine; - } - - public MasterSpec getSpec() { - return spec; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java deleted file mode 100644 index 0cd4bc1..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.domain.LoginCredentials; - -import com.google.common.base.Objects; - -/** - * A complete specification of a "master" node, including the ISO, networking setup and the physical - * machine specification. - */ -public class MasterSpec { - - private VmSpec vmSpec; - private IsoSpec isoSpec; - private NetworkSpec networkSpec; - private LoginCredentials loginCredentials; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private VmSpec vmSpec; - private IsoSpec isoSpec; - private NetworkSpec networkSpec; - private LoginCredentials loginCredentials; - - public Builder vm(VmSpec vmSpec) { - this.vmSpec = vmSpec; - return this; - } - - public Builder network(NetworkSpec networkSpec) { - this.networkSpec = networkSpec; - return this; - } - - public Builder iso(IsoSpec isoSpec) { - this.isoSpec = isoSpec; - return this; - } - - public Builder credentials(LoginCredentials loginCredentials) { - this.loginCredentials = loginCredentials; - return this; - } - - public MasterSpec build() { - return new MasterSpec(vmSpec, isoSpec, networkSpec, loginCredentials); - } - - } - - private MasterSpec(VmSpec vmSpec, IsoSpec isoSpec, NetworkSpec networkSpec, LoginCredentials loginCredentials) { - this.vmSpec = checkNotNull(vmSpec, "vmSpec can't be null"); - this.isoSpec = checkNotNull(isoSpec, "isoSpec can't be null"); - this.networkSpec = checkNotNull(networkSpec, "networkSpec can't be null"); - this.loginCredentials = loginCredentials; - } - - public VmSpec getVmSpec() { - return vmSpec; - } - - public IsoSpec getIsoSpec() { - return isoSpec; - } - - public NetworkSpec getNetworkSpec() { - return networkSpec; - } - - public LoginCredentials getLoginCredentials() { - return loginCredentials; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof MasterSpec) { - MasterSpec other = (MasterSpec) o; - return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(isoSpec, other.isoSpec) - && Objects.equal(networkSpec, other.networkSpec); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(vmSpec, isoSpec, networkSpec); - } - - @Override - public String toString() { - return "IMachineSpec{" + "vmSpec=" + vmSpec + ", isoSpec=" + isoSpec + ", networkSpec=" + networkSpec + '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java deleted file mode 100644 index d036151..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collections; -import java.util.Set; - -import org.virtualbox_4_2.NATProtocol; - -import com.google.common.base.Objects; -import com.google.common.collect.Sets; - -/** - * Represents a NAT network adapter in VirtualBox. - * <p/> - * redirectRules are the redirect rules that are applied to the network adapter. - */ -public class NatAdapter { - - private final Set<RedirectRule> redirectRules = Sets.newLinkedHashSet(); - - public NatAdapter(Set<RedirectRule> redirectRules) { - checkNotNull(redirectRules); - this.redirectRules.addAll(redirectRules); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private Set<RedirectRule> redirectRules = Sets.newLinkedHashSet(); - - /** - * @param host incoming address - * @param hostPort - * @param guest guest address or empty string for all addresses - * @param guestPort - * @return - */ - public Builder tcpRedirectRule(String host, int hostPort, String guest, int guestPort) { - redirectRules.add(new RedirectRule(NATProtocol.TCP, host, hostPort, guest, guestPort)); - return this; - } - - /** - * @param host incoming address - * @param hostPort - * @param guest guest address or empty string for all addresses - * @param guestPort - * @return - */ - public Builder udpRedirectRule(String host, int hostPort, String guest, int guestPort) { - redirectRules.add(new RedirectRule(NATProtocol.UDP, host, hostPort, guest, guestPort)); - return this; - } - - public NatAdapter build() { - return new NatAdapter(redirectRules); - } - - } - - public Set<RedirectRule> getRedirectRules() { - return Collections.unmodifiableSet(redirectRules); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof NatAdapter) { - NatAdapter other = (NatAdapter) o; - return Objects.equal(redirectRules, other.redirectRules); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(redirectRules); - } - - @Override - public String toString() { - return "NatAdapter{" + - "redirectRules=" + redirectRules + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java deleted file mode 100644 index 80ff812..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collections; -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; -import org.virtualbox_4_2.NATProtocol; -import org.virtualbox_4_2.NetworkAttachmentType; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -/** - * Represents a network adapter in VirtualBox. - * <p/> - * redirectRules are the redirect rules that are applied to the network adapter. - */ -public class NetworkAdapter { - - private final NetworkAttachmentType networkAttachmentType; - private final String macAddress; - private final Set<RedirectRule> redirectRules; - private final String staticIp; - - public NetworkAdapter(NetworkAttachmentType networkAttachmentType, - String macAddress, Set<RedirectRule> redirectRules, - String staticIp) { - this.networkAttachmentType = checkNotNull(networkAttachmentType, - "networkAttachmentType can't be null"); - this.macAddress = macAddress; - this.redirectRules = ImmutableSet.<RedirectRule>copyOf(redirectRules); - this.staticIp = staticIp; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private NetworkAttachmentType networkAttachmentType; - private String macAddress; - private Set<RedirectRule> redirectRules = Sets.newLinkedHashSet(); - private String staticIp; - - /** - * - * @param networkAttachmentType - * @return - */ - public Builder networkAttachmentType( - NetworkAttachmentType networkAttachmentType) { - this.networkAttachmentType = networkAttachmentType; - return this; - } - - /** - * - * @param macAddress - * @return - */ - public Builder macAddress(String macAddress) { - this.macAddress = macAddress; - return this; - } - - /** - * @param host - * incoming address - * @param hostPort - * @param guest - * guest address or empty string for all addresses - * @param guestPort - * @return - */ - public Builder tcpRedirectRule(String host, int hostPort, String guest, - int guestPort) { - redirectRules.add(new RedirectRule(NATProtocol.TCP, host, hostPort, - guest, guestPort)); - return this; - } - - /** - * @param host - * incoming address - * @param hostPort - * @param guest - * guest address or empty string for all addresses - * @param guestPort - * @return - */ - public Builder udpRedirectRule(String host, int hostPort, String guest, - int guestPort) { - redirectRules.add(new RedirectRule(NATProtocol.UDP, host, hostPort, - guest, guestPort)); - return this; - } - - public Builder staticIp(@Nullable String staticIp) { - this.staticIp = staticIp; - return this; - } - - public NetworkAdapter build() { - return new NetworkAdapter(networkAttachmentType, macAddress, - redirectRules, staticIp); - } - } - - public NetworkAttachmentType getNetworkAttachmentType() { - return networkAttachmentType; - } - - public Set<RedirectRule> getRedirectRules() { - return Collections.unmodifiableSet(redirectRules); - } - - public String getMacAddress() { - return macAddress; - } - - public String getStaticIp() { - return staticIp; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof NetworkAdapter) { - NetworkAdapter other = (NetworkAdapter) o; - return Objects.equal(networkAttachmentType, - other.networkAttachmentType) && - Objects.equal(macAddress, other.macAddress) && - Objects.equal(redirectRules, other.redirectRules); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(networkAttachmentType, macAddress, redirectRules); - } - - @Override - public String toString() { - return "NetworkAdapter{networkAttachmentType=" + - networkAttachmentType + - ", macAddress=" + macAddress + - ", redirectRules=" + redirectRules + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java deleted file mode 100644 index 7ee0278..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Objects; - -public class NetworkInterfaceCard { - - private final long slot; - private final NetworkAdapter networkAdapter; - private final String hostInterfaceName; - private final boolean enabled; - - public NetworkInterfaceCard(long slot, NetworkAdapter networkAdapter, String hostInterfaceName, boolean enabled) { - this.slot = checkNotNull(slot, "slot can't be null"); - this.networkAdapter = checkNotNull(networkAdapter, "networkAdapter can't be null"); - this.hostInterfaceName = hostInterfaceName; - this.enabled = enabled; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private long slot = 0L; - private NetworkAdapter networkAdapter; - private String hostInterfaceName; - private boolean enabled = true; - - public Builder slot(long slot) { - checkArgument(slot >= 0 && slot < 4, "must be 0, 1, 2, 3: %s", slot); - this.slot = slot; - return this; - } - - public Builder addNetworkAdapter( - NetworkAdapter networkAdapter) { - this.networkAdapter = networkAdapter; - return this; - } - - public Builder addHostInterfaceName( - String hostInterfaceName) { - this.hostInterfaceName = hostInterfaceName; - return this; - } - - public Builder enabled( - boolean enabled) { - this.enabled = enabled; - return this; - } - - public NetworkInterfaceCard build() { - return new NetworkInterfaceCard(slot, networkAdapter, hostInterfaceName, enabled); - } - } - - public long getSlot() { - return slot; - } - - public NetworkAdapter getNetworkAdapter() { - return networkAdapter; - } - - public String getHostInterfaceName() { - return hostInterfaceName; - } - - public boolean isEnabled() { - return enabled; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof NetworkInterfaceCard) { - NetworkInterfaceCard other = (NetworkInterfaceCard) o; - return Objects.equal(slot, - other.slot) && - Objects.equal(networkAdapter, other.networkAdapter) - && Objects.equal(enabled, other.enabled); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(slot, networkAdapter, enabled); - } - - @Override - public String toString() { - return "NetworkInterfaceCard{slot=" + - slot + - ", networkAdapter=" + networkAdapter + - ", enabled=" + enabled + - '}'; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java deleted file mode 100644 index 98fa59e..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.List; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -/** - * Describes the network configuration for a VirtualBox machine. - */ -public class NetworkSpec { - - private final List<NetworkInterfaceCard> networkInterfaceCards; - - public NetworkSpec(final List<NetworkInterfaceCard> networkInterfaceCards) { - this.networkInterfaceCards = ImmutableList.copyOf(checkNotNull(networkInterfaceCards, "networkInterfaceCards can't be null")); - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private List<NetworkInterfaceCard> networkInterfaceCards = Lists.newArrayList(); - - public Builder addNIC(NetworkInterfaceCard networkInterfaceCard) { - this.networkInterfaceCards.add(networkInterfaceCard); - return this; - } - - public NetworkSpec build() { - return new NetworkSpec(networkInterfaceCards); - } - } - - public List<NetworkInterfaceCard> getNetworkInterfaceCards() { - return networkInterfaceCards; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof NetworkSpec) { - NetworkSpec other = (NetworkSpec) o; - return Objects.equal(networkInterfaceCards, other.networkInterfaceCards); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(networkInterfaceCards); - } - - @Override - public String toString() { - return "NetworkSpec{" + "networkInterfaceCards= " + networkInterfaceCards + '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java deleted file mode 100644 index 8c14b73..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import org.jclouds.compute.domain.Template; - -public class NodeSpec { - - private final Master master; - private final String name; - private final String tag; - private final Template template; - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private Master master; - private String name; - private String tag; - private Template template; - - public Builder master(Master master) { - this.master = master; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - public Builder template(Template template) { - this.template = template; - return this; - } - - public NodeSpec build() { - return new NodeSpec(master, name, tag, template); - } - - } - - private NodeSpec(Master master, String name, String tag, Template template) { - super(); - this.master = master; - this.name = name; - this.tag = tag; - this.template = template; - } - - public Master getMaster() { - return master; - } - - public String getName() { - return name; - } - - public String getTag() { - return tag; - } - - public Template getTemplate() { - return template; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java deleted file mode 100644 index 106d7b3..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.virtualbox_4_2.NATProtocol; - -import com.google.common.base.Objects; - -public class RedirectRule { - - private final NATProtocol protocol; - private final String host; - private final int hostPort; - private final String guest; - private final int guestPort; - - /** - * @param protocol - * @param host incoming address - * @param hostPort - * @param guest guest address or empty string for all addresses - * @param guestPort - * @return - */ - public RedirectRule(NATProtocol protocol, String host, int hostPort, String guest, int guestPort) { - checkNotNull(protocol); - checkNotNull(host); - checkNotNull(guest); - this.protocol = protocol; - this.host = host; - this.hostPort = hostPort; - this.guest = guest; - this.guestPort = guestPort; - } - - public NATProtocol getProtocol() { - return protocol; - } - - public String getHost() { - return host; - } - - public int getHostPort() { - return hostPort; - } - - public String getGuest() { - return guest; - } - - public int getGuestPort() { - return guestPort; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof RedirectRule) { - RedirectRule other = (RedirectRule) o; - return Objects.equal(protocol, other.protocol) && - Objects.equal(host, other.host) && - Objects.equal(hostPort, other.hostPort) && - Objects.equal(guest, other.guest) && - Objects.equal(guestPort, other.guestPort); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(protocol, host, hostPort, guest, guestPort); - } - - @Override - public String toString() { - return "RedirectRule{" + - "protocol=" + protocol + - ", host='" + host + '\'' + - ", hostPort=" + hostPort + - ", guest='" + guest + '\'' + - ", guestPort=" + guestPort + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java deleted file mode 100644 index fa13bde..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.collect.Iterables.filter; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; -import org.virtualbox_4_2.DeviceType; -import org.virtualbox_4_2.StorageBus; - -import com.google.common.base.Objects; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * Represents a storage controller in a VirtualBox VM. - * <p/> - * name is the unique name of the controller. - * bus is the type of connection bus for the controller - * hardDisks contains the hard disks that are attached (or should be attached) to this controller - * isoImages contains the ISOs that are attached (or should be attached) to this controller - * - * @see StorageBus - */ -public class StorageController { - private final String name; - private final StorageBus bus; - private Set<HardDisk> hardDisks; - private Set<IsoImage> isoImages; - - public StorageController(String name, StorageBus bus, Set<HardDisk> hardDisks, Set<IsoImage> isoImages) { - this.name = checkNotNull(name, "storage name can't be null"); - this.bus = checkNotNull(bus, "bus can't be null"); - this.hardDisks = checkNotNull(hardDisks, "hardDisks can't be null"); - this.isoImages = checkNotNull(isoImages, "isoImages can't be null"); - } - - public String getName() { - return name; - } - - public StorageBus getBus() { - return bus; - } - - public HardDisk getHardDisk(String diskName) { - - final Iterable<HardDisk> hardDisks = filter(getHardDisks(), new HardDiskPredicate(diskName)); - return Iterables.getFirst(hardDisks, HardDisk.builder().diskpath("notfound").controllerPort(0).deviceSlot(0).build()); - } - - public Set<HardDisk> getHardDisks() { - return hardDisks; - } - - public Set<IsoImage> getIsoImages() { - return isoImages; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o instanceof StorageController) { - StorageController other = (StorageController) o; - return Objects.equal(name, other.name) && - Objects.equal(bus, other.bus) && - Objects.equal(hardDisks, other.hardDisks) && - Objects.equal(isoImages, other.isoImages); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, bus, hardDisks, isoImages); - } - - @Override - public String toString() { - return "StorageController{" + - "name='" + name + '\'' + - ", bus=" + bus + - ", hardDisks=" + hardDisks + - ", isoImages=" + isoImages + - '}'; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private String name; - private StorageBus bus; - private Set<HardDisk> hardDisks = Sets.newHashSet(); - private Set<IsoImage> dvds = Sets.newHashSet(); - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder bus(StorageBus bus) { - this.bus = bus; - return this; - } - - public Builder attachISO(int controllerPort, int deviceSlot, String sourcePath) { - dvds.add(new IsoImage(new DeviceDetails(controllerPort, deviceSlot, DeviceType.DVD), sourcePath)); - return this; - } - - public Builder attachHardDisk(HardDisk hardDisk) { - hardDisks.add(hardDisk); - return this; - } - - public StorageController build() { - checkNotNull(name); - checkNotNull(bus); - return new StorageController(name, bus, hardDisks, dvds); - } - } - - private static class HardDiskPredicate implements Predicate<HardDisk> { - - private String diskName; - - public HardDiskPredicate(String diskName) { - this.diskName = diskName; - } - - @Override - public boolean apply(@Nullable HardDisk hardDisk) { - return hardDisk.getName().equals(diskName); - } - }; -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java deleted file mode 100644 index 23a3fc4..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collections; -import java.util.Set; - -import org.virtualbox_4_2.CleanupMode; - -import com.google.common.base.Objects; -import com.google.common.collect.Sets; - -/** - * A description of a Virtual Machine in VirtualBox. - */ -public class VmSpec { - - private final String vmName; - private final String osTypeId; - private final String vmId; - private final long memory; - private final boolean forceOverwrite; - private final Set<StorageController> controllers; - private final CleanupMode cleanupMode; - - public VmSpec(String vmId, String vmName, String osTypeId, long memory, String guestUser, String guestPassword, boolean forceOverwrite, - Set<StorageController> controllers, CleanupMode cleanupMode) { - this.vmId = checkNotNull(vmId, "vmId can't be null"); - this.vmName = checkNotNull(vmName, "vmName can't be null"); - this.osTypeId = checkNotNull(osTypeId, "osTypeId can't be null"); - checkArgument(memory > 0, "memory must be > 0"); - this.memory = memory; - this.controllers = checkNotNull(controllers, "controllers can't be null"); - this.cleanupMode = checkNotNull(cleanupMode, "cleanupMode can't be null"); - this.forceOverwrite = forceOverwrite; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private Set<StorageController> controllers = Sets.newHashSet(); - - private String name; - private String id; - private String osTypeId = ""; - private boolean forceOverwrite = true; - private long memory; - private String guestUser; - private String guestPassword; - private CleanupMode cleanUpMode; - - public Builder controller(StorageController controller) { - controllers.add(controller); - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder osTypeId(String osTypeId) { - this.osTypeId = osTypeId; - return this; - } - - public Builder forceOverwrite(boolean forceOverwrite) { - this.forceOverwrite = forceOverwrite; - return this; - } - - public Builder memoryMB(int memorySize) { - this.memory = (long) memorySize; - return this; - } - - public Builder cleanUpMode(CleanupMode cleanupMode) { - this.cleanUpMode = cleanupMode; - return this; - } - - public Builder guestUser(String guestUser) { - this.guestUser = guestUser; - return this; - } - - public Builder guestPassword(String guestPassword) { - this.guestPassword = guestPassword; - return this; - } - - public VmSpec build() { - checkNotNull(name, "name"); - checkNotNull(id, "id"); - checkArgument(memory > 0, "Memory must be set"); - return new VmSpec(id, name, osTypeId, memory, guestUser, guestPassword, forceOverwrite, controllers, cleanUpMode); - } - - } - - public String getVmId() { - return vmId; - } - - public String getVmName() { - return vmName; - } - - public String getOsTypeId() { - return osTypeId; - } - - public long getMemory() { - return memory; - } - - public boolean isForceOverwrite() { - return forceOverwrite; - } - - public Set<StorageController> getControllers() { - return Collections.unmodifiableSet(controllers); - } - - public CleanupMode getCleanupMode() { - return cleanupMode; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o instanceof VmSpec) { - VmSpec other = (VmSpec) o; - return Objects.equal(vmId, other.vmId) && Objects.equal(vmName, other.vmName) - && Objects.equal(osTypeId, other.osTypeId) && Objects.equal(memory, other.memory) - && Objects.equal(forceOverwrite, other.forceOverwrite) - && Objects.equal(controllers, other.controllers) && Objects.equal(cleanupMode, other.cleanupMode); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(vmId, vmName, osTypeId, memory, forceOverwrite, controllers); - } - - @Override - public String toString() { - return "VmSpecification{" + "vmName='" + vmName + '\'' + ", osTypeId='" + osTypeId + '\'' + ", memory='" + memory - + '\'' + ", vmId='" + vmId + '\'' + '\'' - + ", forceOverwrite=" + forceOverwrite + ", controllers=" - + controllers + ", cleanupMode=" + cleanupMode + '}'; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java deleted file mode 100644 index c0dd59b..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.domain; - -import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized; - -import java.util.List; -import java.util.Map; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.domain.LoginCredentials; - -import com.google.common.base.Function; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -/** - * Serializes to the following - * - * <pre> - * id: myTestId - * name: ubuntu-11.04-server-i386 - * description: ubuntu 11.04 server (i386) - * os_arch: x86 - * os_family: linux - * os_description: ubuntu - * os_version: 11.04 - * iso: http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso - * keystroke_sequence: | - * <Esc><Esc><Enter> - * /install/vmlinuz noapic preseed/url=http://10.0.2.2:8080/src/test/resources/preseed.cfg - * debian-installer=en_US auto locale=en_US kbd-chooser/method=us - * hostname=vmName - * fb=false debconf/frontend=noninteractive - * keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false - * initrd=/install/initrd.gz -- <Enter> - * preseed_cfg: | - * ## Options to set on the command line - * d-i debian-installer/locale string en_US.utf8 - * d-i console-setup/ask_detect boolean false - * d-i console-setup/layout string USA - * d-i netcfg/get_hostname string unassigned-hostname - * d-i netcfg/get_domain string unassigned-domain - * # Continue without a default route - * # Not working , specify a dummy in the DHCP - * d-i time/zone string UTC - * d-i clock-setup/utc-auto boolean true - * d-i clock-setup/utc boolean true - * d-i kbd-chooser/method select American English - * d-i netcfg/wireless_wep string - * d-i base-installer/kernel/override-image string linux-server - * # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive - * d-i debconf debconf/frontend select Noninteractive - * d-i pkgsel/install-language-support boolean false - * tasksel tasksel/first multiselect standard, ubuntu-server - * d-i partman-auto/method string lvm - * d-i partman-lvm/confirm boolean true - * d-i partman-lvm/device_remove_lvm boolean true - * d-i partman-auto/choose_recipe select atomic - * d-i partman/confirm_write_new_label boolean true - * d-i partman/confirm_nooverwrite boolean true - * d-i partman/choose_partition select finish - * d-i partman/confirm boolean true - * # Write the changes to disks and configure LVM? - * d-i partman-lvm/confirm boolean true - * d-i partman-lvm/confirm_nooverwrite boolean true - * d-i partman-auto-lvm/guided_size string max - * ## Default user, we can get away with a recipe to change this - * d-i passwd/user-fullname string toor - * d-i passwd/username string toor - * d-i passwd/user-password password password - * d-i passwd/user-password-again password password - * d-i user-setup/encrypt-home boolean false - * d-i user-setup/allow-password-weak boolean true - * # Individual additional packages to install - * d-i pkgsel/include string openssh-server ntp - * # Whether to upgrade packages after debootstrap. - * # Allowed values: none, safe-upgrade, full-upgrade - * d-i pkgsel/upgrade select full-upgrade - * d-i grub-installer/only_debian boolean true - * d-i grub-installer/with_other_os boolean true - * d-i finish-install/reboot_in_progress note - * #For the update - * d-i pkgsel/update-policy select none - * # debconf-get-selections --install - * #Use mirror - * choose-mirror-bin mirror/http/proxy string - * </pre> - */ -public class YamlImage { - public String id; - public String name; - public String description; - public String hostname; - public String location_id; - public String os_arch; - public String os_family; - public String os_description; - public String os_version; - public String iso_md5; - public String iso; - public String keystroke_sequence; - public String preseed_cfg; - public int login_port = 22; - public boolean os_64bit; - public String group; - public List<String> tags = Lists.newArrayList(); - public Map<String, String> metadata = Maps.newLinkedHashMap(); - public String username; - public String credential; - public String credential_url; - public String sudo_password; - - public static final Function<YamlImage, Image> toImage = new Function<YamlImage, Image>() { - @Override - public Image apply(YamlImage arg0) { - if (arg0 == null) - return null; - - OsFamily family = parseOsFamilyOrUnrecognized(arg0.os_family); - - OperatingSystem operatingSystem = OperatingSystem.builder().description(arg0.os_description).family(family) - .version(arg0.os_version).is64Bit(arg0.os_64bit).arch(arg0.os_arch).build(); - - return new ImageBuilder().id(arg0.id).name(arg0.name).description(arg0.description) - .operatingSystem(operatingSystem).status(Image.Status.AVAILABLE) - .defaultCredentials(LoginCredentials.builder() - .user(arg0.username) - .password(arg0.credential) - .authenticateSudo(true).build()) - .build(); - } - }; - - public Image toImage() { - return toImage.apply(this); - } - - @Override - public String toString() { - return "YamlImage [id=" + id + ", name=" + name + ", description=" + description + ", hostname=" + hostname - + ", location_id=" + location_id + ", os_arch=" + os_arch + ", os_family=" + os_family - + ", os_description=" + os_description + ", os_version=" + os_version + ", iso=" + iso - + ", keystroke_sequence=" + keystroke_sequence + ", preseed_cfg=" + preseed_cfg + ", login_port=" - + login_port + ", os_64bit=" + os_64bit + ", group=" + group + ", tags=" + tags + ", metadata=" - + metadata + ", username=" + username + ", credential=" + credential + ", credential_url=" - + credential_url + ", sudo_password=" + sudo_password + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java deleted file mode 100644 index 7d6ee13..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.virtualbox.domain.StorageController; -import org.virtualbox_4_2.IMachine; -import org.virtualbox_4_2.VBoxException; - -import com.google.common.base.Function; - -public class AddIDEControllerIfNotExists implements Function<IMachine, Void> { - private final StorageController storageController; - - public AddIDEControllerIfNotExists(StorageController storageController) { - this.storageController = checkNotNull(storageController, "storageController can't be null"); - } - - @Override - public Void apply(IMachine machine) { - try { - machine.addStorageController(storageController.getName(), storageController.getBus()); - machine.saveSettings(); - } catch (VBoxException e) { - if (!e.getMessage().contains("already exists")) - throw e; - } - return null; - } - - @Override - public String toString() { - return String.format("addStorageController(%s)", storageController); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java deleted file mode 100644 index addd1e5..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.functions; - -import com.google.common.base.Function; -import org.virtualbox_4_2.DeviceType; -import org.virtualbox_4_2.IMachine; - -import java.util.Map; - -public class ApplyBootOrderToMachine implements Function<IMachine, Void> { - - - private Map<Long, DeviceType> positionAndDeviceType; - - public ApplyBootOrderToMachine(Map<Long, DeviceType> positionAndDeviceType) { - this.positionAndDeviceType = positionAndDeviceType; - } - - @Override - public Void apply(IMachine machine) { - for (long position : positionAndDeviceType.keySet()) { - machine.setBootOrder(position, positionAndDeviceType.get(position)); - } - machine.saveSettings(); - return null; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java ---------------------------------------------------------------------- diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java deleted file mode 100644 index 352a8bb..0000000 --- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.virtualbox.functions; - -import org.virtualbox_4_2.IMachine; - -import com.google.common.base.Function; - -public class ApplyMemoryToMachine implements Function<IMachine, Void> { - - private long memorySize; - - public ApplyMemoryToMachine(long memorySize) { - this.memorySize = memorySize; - } - - @Override - public Void apply(IMachine machine) { - machine.setMemorySize(memorySize); - machine.saveSettings(); - return null; - } -}
