diff options
author | Victor Mocanu | 2017-10-26 12:58:30 +0200 |
---|---|---|
committer | Victor Mocanu | 2017-10-26 12:58:30 +0200 |
commit | a9b730ee13d921616d4f9d6e3420bc7453c654f3 (patch) | |
tree | 1d0649a22bd18e5efc32f028a60ffa8cedef5de2 /src/main/java/org/openslx/util/vm/VmMetaData.java | |
parent | [VBox] changed comments to english, renamed some variables (diff) | |
download | master-sync-shared-a9b730ee13d921616d4f9d6e3420bc7453c654f3.tar.gz master-sync-shared-a9b730ee13d921616d4f9d6e3420bc7453c654f3.tar.xz master-sync-shared-a9b730ee13d921616d4f9d6e3420bc7453c654f3.zip |
[VBox] work in progress for the DropDownSelectWindow... everything was vmx specific, made it more generic
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VmMetaData.java')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VmMetaData.java | 123 |
1 files changed, 119 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java index a32da4e..1130f9b 100644 --- a/src/main/java/org/openslx/util/vm/VmMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmMetaData.java @@ -5,7 +5,9 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import org.apache.log4j.Logger; @@ -16,16 +18,92 @@ import org.openslx.bwlp.thrift.iface.Virtualizer; * Describes a configured virtual machine. This class is parsed from a machine * description, like a *.vmx for VMware machines. */ -public abstract class VmMetaData +public abstract class VmMetaData<T, U, V, W> { private static final Logger LOGGER = Logger.getLogger( VmMetaData.class ); + /* * Helper types */ + protected Map<SoundCardType, T> soundCards = new HashMap<>(); + protected Map<DDAcceleration, U> ddacc = new HashMap<>(); + protected Map<HWVersion, V> hwversion = new HashMap<>(); + protected Map<EthernetDevType, W> networkCards = new HashMap<>(); + + public static enum SoundCardType + { + NONE( "None" ), + DEFAULT( "(default)" ), + SOUND_BLASTER( "Sound Blaster 16" ), + ES( "ES 1371" ), + HD_AUDIO( "Intel Integrated HD Audio" ); + + public final String displayName; + + private SoundCardType( String dName ) + { + this.displayName = dName; + } + } + + public static enum DDAcceleration + { + OFF( "Off" ), + ON( "On" ); + + public final String displayName; + + private DDAcceleration( String dName ) + { + this.displayName = dName; + } + } + + // Virtual hardware version + public static enum HWVersion + { + NONE( "(invalid)" ), + THREE( " 3 (Workstation 4/5, Player 1)" ), + FOUR( " 4 (Workstation 4/5, Player 1/2, Fusion 1)" ), + SIX( " 6 (Workstation 6)" ), + SEVEN( " 7 (Workstation 6.5/7, Player 3, Fusion 2/3)" ), + EIGHT( " 8 (Workstation 8, Player/Fusion 4)" ), + NINE( " 9 (Workstation 9, Player/Fusion 5)" ), + TEN( "10 (Workstation 10, Player/Fusion 6)" ), + ELEVEN( "11 (Workstation 11, Player/Fusion 7)" ), + TWELVE( "12 (Workstation/Player 12, Fusion 8)" ); + + public final String displayName; + + private HWVersion( String dName ) + { + this.displayName = dName; + } + } + + // Virtual network adapter + public static enum EthernetDevType + { + AUTO( "(default)" ), + PCNET32( "AMD PCnet32" ), + E1000( "Intel E1000 (PCI)" ), + E1000E( "Intel E1000e (PCI-Express)" ), + VMXNET( "VMXnet" ), + VMXNET3( "VMXnet 3" ); + + public final String displayName; + + private EthernetDevType( String dName ) + { + this.displayName = dName; + } + } public static enum DriveBusType { - SCSI, IDE, SATA; + SCSI, + IDE, + SATA; } public static class HardDisk @@ -53,9 +131,28 @@ public abstract class VmMetaData private OperatingSystem os = null; protected String displayName = null; + /* * Guettas */ + public List<SoundCardType> getSupportedSoundCards() + { + return new ArrayList<SoundCardType>( soundCards.keySet() ); + } + + public List<DDAcceleration> getSupportedDDAccs() + { + return new ArrayList<DDAcceleration>( ddacc.keySet() ); + } + + public List<HWVersion> getSupportedHWVersions() + { + return new ArrayList<HWVersion>( hwversion.keySet() ); + } + + public List<EthernetDevType> getSupportedEthernetDevices() { + return new ArrayList<EthernetDevType>( networkCards.keySet() ); + } /** * Get operating system of this VM. @@ -164,8 +261,7 @@ public abstract class VmMetaData } // meta object needed when reading from configarray - public static VmMetaData getInstance( List<OperatingSystem> osList, byte[] vmContent, int length ) - throws IOException + public static VmMetaData getInstance( List<OperatingSystem> osList, byte[] vmContent, int length ) throws IOException { try { return new VmwareMetaData( osList, vmContent, length ); @@ -199,4 +295,23 @@ public abstract class VmMetaData public abstract boolean addCpuCoreCount( int nrOfCores ); + public abstract void setSoundCard( SoundCardType type ); + + public abstract SoundCardType getSoundCard(); + + + public abstract void setDDAcceleration( DDAcceleration type ); + + public abstract DDAcceleration getDDAcceleration(); + + public abstract void setHWVersion( HWVersion type ); + + public abstract HWVersion getHWVersion(); + // TODO export to VmMetaData like SoundCardType + public abstract void setEthernetDevType( int cardIndex, EthernetDevType type ); + + public abstract EthernetDevType getEthernetDevType( int cardIndex ); + + public abstract byte[] getDefinitionArray(); + } |