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.java63
1 files changed, 30 insertions, 33 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 5a768a4e..24021e1a 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.virtualization.configuration.VmMetaData;
-import org.openslx.virtualization.configuration.VmMetaData.DDAcceleration;
-import org.openslx.virtualization.configuration.VmMetaData.EthernetDevType;
-import org.openslx.virtualization.configuration.VmMetaData.HWVersion;
-import org.openslx.virtualization.configuration.VmMetaData.SoundCardType;
-import org.openslx.virtualization.configuration.VmMetaData.UsbSpeed;
-import org.openslx.virtualization.configuration.machine.VboxMetaData;
+import org.openslx.virtualization.configuration.VirtualizationConfigurationVirtualBox;
+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.HWVersion;
+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.getSupportedHWVersions());
+ 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());
}
});
@@ -107,7 +104,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
@Override
public void actionPerformed(ActionEvent e) {
HWVersion selected = (HWVersion) cboHWVersion.getSelectedItem();
- meta.setHWVersion(selected);
+ virtualizationConfig.setHWVersion(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.getDefinitionArray()));
else
currentMachineDesc = ThriftUtil
- .byteBufferToString(ByteBuffer.wrap(meta.getDefinitionArray()));
+ .byteBufferToString(ByteBuffer.wrap(virtualizationConfig.getDefinitionArray()));
boolean didSave = VirtConfigEditorWindow.open(me, actionHandler, imageVersionId,
currentMachineDesc, originalMachineDescription);
// user did save the changes via the expert mode window - close this one too
@@ -175,10 +172,10 @@ 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);
@@ -199,7 +196,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.getDefinitionArray()),
new VirtConfCallback() {
@Override
public void virtConfCallback(boolean success) {
@@ -219,7 +216,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
private boolean hasChanged() {
return !originalMachineDescription
- .equals(ThriftUtil.byteBufferToString(ByteBuffer.wrap(meta.getDefinitionArray())));
+ .equals(ThriftUtil.byteBufferToString(ByteBuffer.wrap(virtualizationConfig.getDefinitionArray())));
}
private void safeClose() {