summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java75
1 files changed, 39 insertions, 36 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
index b44cc764..680b9b7c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
@@ -20,13 +20,13 @@ import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.sat.thrift.version.Feature;
import org.openslx.util.ThriftUtil;
import org.openslx.util.XmlHelper;
-import org.openslx.vm.VboxMetaData;
-import org.openslx.vm.VmMetaData;
-import org.openslx.vm.VmMetaData.DDAcceleration;
-import org.openslx.vm.VmMetaData.EthernetDevType;
-import org.openslx.vm.VmMetaData.HWVersion;
-import org.openslx.vm.VmMetaData.SoundCardType;
-import org.openslx.vm.VmMetaData.UsbSpeed;
+import org.openslx.virtualization.configuration.VirtualizationConfigurationVirtualBox;
+import org.openslx.virtualization.Version;
+import org.openslx.virtualization.configuration.VirtualizationConfiguration;
+import org.openslx.virtualization.configuration.VirtualizationConfiguration.DDAcceleration;
+import org.openslx.virtualization.configuration.VirtualizationConfiguration.EthernetDevType;
+import org.openslx.virtualization.configuration.VirtualizationConfiguration.SoundCardType;
+import org.openslx.virtualization.configuration.VirtualizationConfiguration.UsbSpeed;
public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWindowLayout
implements UiFeedback {
@@ -45,7 +45,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
private final String imageVersionId;
private final String originalMachineDescription;
private final VirtDropDownConfigEditorWindow me = this;
- private final VmMetaData<?, ?, ?, ?, ?> meta;
+ private VirtualizationConfiguration<?, ?, ?, ?> virtualizationConfig = null;
private final ImageDetailsActions actionHandler;
protected VirtDropDownConfigEditorWindow(Window modalParent, final ImageDetailsActions actionHandler,
@@ -56,38 +56,35 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
this.imageVersionId = imageVersionId;
// and now for the meta data
- VmMetaData<?, ?, ?, ?, ?> metaCandidate = null;
byte[] machineData = ThriftUtil.unwrapByteBuffer(machineDescription);
try {
- metaCandidate = VmMetaData.getInstance(MetaDataCache.getOperatingSystems(), machineData,
- machineData.length);
+ virtualizationConfig = VirtualizationConfiguration.getInstance(MetaDataCache.getOperatingSystems(),
+ machineData, machineData.length);
} catch (IOException e) {
LOGGER.error("Could not get VmMetaData instance from given machine description: ", e);
}
-
- meta = metaCandidate;
- if (metaCandidate == null) {
+ if (virtualizationConfig == null) {
this.originalMachineDescription = null;
dispose();
return;
}
- initializeSoundBox(meta.getSupportedSoundCards());
- initializeDDABox(meta.getSupportedDDAccs());
- initializeHWVersBox(meta.getSupportedHWVersions());
- initializeEDTBox(meta.getSupportedEthernetDevices());
- initializeUsbBox(meta.getSupportedUsbSpeeds());
+ initializeSoundBox(virtualizationConfig.getSupportedSoundCards());
+ initializeDDABox(virtualizationConfig.getSupportedDDAccs());
+ initializeHWVersBox(virtualizationConfig.getVirtualizer().getSupportedVersions());
+ initializeEDTBox(virtualizationConfig.getSupportedEthernetDevices());
+ initializeUsbBox(virtualizationConfig.getSupportedUsbSpeeds());
//set the initial state of the buttons
- initializeComboBoxes(meta);
+ initializeComboBoxes(virtualizationConfig);
// listener for the sound card drop box
cboSound.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SoundCardType selected = (SoundCardType) cboSound.getSelectedItem();
- meta.setSoundCard(selected);
+ virtualizationConfig.setSoundCard(selected);
btnSave.setEnabled(hasChanged());
}
});
@@ -97,7 +94,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
@Override
public void actionPerformed(ActionEvent e) {
DDAcceleration selected = (DDAcceleration) cbo3DAcceleration.getSelectedItem();
- meta.setDDAcceleration(selected);
+ virtualizationConfig.setDDAcceleration(selected);
btnSave.setEnabled(hasChanged());
}
});
@@ -106,8 +103,8 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
cboHWVersion.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- HWVersion selected = (HWVersion) cboHWVersion.getSelectedItem();
- meta.setHWVersion(selected);
+ Version selected = (Version) cboHWVersion.getSelectedItem();
+ virtualizationConfig.setVirtualizerVersion(selected);
btnSave.setEnabled(hasChanged());
}
});
@@ -117,7 +114,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
@Override
public void actionPerformed(ActionEvent e) {
EthernetDevType selected = (EthernetDevType) cboE0VirtDev.getSelectedItem();
- meta.setEthernetDevType(0, selected);
+ virtualizationConfig.setEthernetDevType(0, selected);
btnSave.setEnabled(hasChanged());
}
});
@@ -127,7 +124,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
@Override
public void actionPerformed(ActionEvent e) {
UsbSpeed selected = (UsbSpeed) cboMaxUsbSpeed.getSelectedItem();
- meta.setMaxUsbSpeed(selected);
+ virtualizationConfig.setMaxUsbSpeed(selected);
btnSave.setEnabled(hasChanged());
}
});
@@ -156,12 +153,12 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
// here we need special logic for formatting vbox file in a human-readable way...
// we will just format it before sending it to the editor window and reformat it right after...
String currentMachineDesc;
- if (meta instanceof VboxMetaData)
+ if (virtualizationConfig instanceof VirtualizationConfigurationVirtualBox)
currentMachineDesc = XmlHelper
- .getFormattedXml(new ByteArrayInputStream(meta.getDefinitionArray()));
+ .getFormattedXml(new ByteArrayInputStream(virtualizationConfig.getConfigurationAsByteArray()));
else
currentMachineDesc = ThriftUtil
- .byteBufferToString(ByteBuffer.wrap(meta.getDefinitionArray()));
+ .byteBufferToString(ByteBuffer.wrap(virtualizationConfig.getConfigurationAsByteArray()));
boolean didSave = VirtConfigEditorWindow.open(me, actionHandler, imageVersionId,
currentMachineDesc, originalMachineDescription);
// user did save the changes via the expert mode window - close this one too
@@ -175,17 +172,23 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
btnSave.setEnabled(false);
}
- /* setting the boxes to their initial value...value is read from the given metaData
- * @param: given VmwareMetaData
+ /*
+ * setting the boxes to their initial value...value is read from the given virtualization configuration
*/
- private void initializeComboBoxes(VmMetaData<?, ?, ?, ?, ?> m) {
+ private void initializeComboBoxes(VirtualizationConfiguration<?, ?, ?, ?> m) {
try {
SoundCardType SCT = m.getSoundCard();
cboSound.setSelectedItem(SCT);
DDAcceleration DDA = m.getDDAcceleration();
cbo3DAcceleration.setSelectedItem(DDA);
- HWVersion HWV = m.getHWVersion();
- cboHWVersion.setSelectedItem(HWV);
+
+ // initialize version value in combobox
+ Version HWV = m.getVirtualizerVersion();
+ if (HWV != null) {
+ // set version value specified in the virtualization configuration as default if specified
+ cboHWVersion.setSelectedItem(HWV);
+ }
+
EthernetDevType E0VD = m.getEthernetDevType(0);
cboE0VirtDev.setSelectedItem(E0VD);
UsbSpeed usbSpeed = m.getMaxUsbSpeed();
@@ -199,7 +202,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
private void saveClicked() {
// we have a valid vmx or the user accepted to push the filtered input
- actionHandler.setVirtualizerConfig(imageVersionId, ByteBuffer.wrap(meta.getDefinitionArray()),
+ actionHandler.setVirtualizerConfig(imageVersionId, ByteBuffer.wrap(virtualizationConfig.getConfigurationAsByteArray()),
new VirtConfCallback() {
@Override
public void virtConfCallback(boolean success) {
@@ -219,7 +222,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
private boolean hasChanged() {
return !originalMachineDescription
- .equals(ThriftUtil.byteBufferToString(ByteBuffer.wrap(meta.getDefinitionArray())));
+ .equals(ThriftUtil.byteBufferToString(ByteBuffer.wrap(virtualizationConfig.getConfigurationAsByteArray())));
}
private void safeClose() {