summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-07-08 19:39:35 +0200
committerSimon Rettberg2015-07-08 19:39:35 +0200
commit8d6cd17c330388aa13fd7c39802c7400d85f972c (patch)
tree5f2c5856f58b1454e24dc16fad10751dfe9d087b
parentoops (diff)
downloadtutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.gz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.xz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.zip
[client] Redo package structure, add comments/TODOs, rename GUI classes
-rw-r--r--dozentenmodul/src/main/java/ftp/DownloadTask.java315
-rw-r--r--dozentenmodul/src/main/java/gui/helper/ColumnSelector.java30
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/App.java (renamed from dozentenmodul/src/main/java/App.java)10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/Config.java (renamed from dozentenmodul/src/main/java/config/Config.java)122
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWIDMAuthenticator.java (renamed from dozentenmodul/src/main/java/auth/BWIDMAuthenticator.java)6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWLPAuthenticator.java (renamed from dozentenmodul/src/main/java/auth/BWLPAuthenticator.java)5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BaseAuthenticator.java (renamed from dozentenmodul/src/main/java/auth/BaseAuthenticator.java)4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java (renamed from dozentenmodul/src/main/java/util/ServiceProviderResponse.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java (renamed from dozentenmodul/src/main/java/util/ShibbolethECP.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/DownloadTask.java171
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java (renamed from dozentenmodul/src/main/java/ftp/UploadTask.java)4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/BlockProgressBar.java (renamed from dozentenmodul/src/main/java/gui/controls/BlockProgressBar.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java (renamed from dozentenmodul/src/main/java/gui/GuiManager.java)4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java (renamed from dozentenmodul/src/main/java/util/MessageType.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java (renamed from dozentenmodul/src/main/java/gui/helper/VMColumns.java)26
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java (renamed from dozentenmodul/src/main/java/gui/core/DisclaimerGUI.java)20
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java (renamed from dozentenmodul/src/main/java/gui/core/LoginGUI.java)32
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java (renamed from dozentenmodul/src/main/java/gui/core/VMWareInfoGUI.java)16
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java (renamed from dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java)8
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java (renamed from dozentenmodul/src/main/java/gui/core/ImageWindowComposite.java)16
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java (renamed from dozentenmodul/src/main/java/gui/core/LoginComposite.java)9
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainWindowLayout.java (renamed from dozentenmodul/src/main/java/gui/core/MainWindowComposite.java)74
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java (renamed from dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java)28
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java (renamed from dozentenmodul/src/main/java/wizards/ImageWizard.java)5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java (renamed from dozentenmodul/src/main/java/wizards/ImageMetaDataPage.java)32
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java (renamed from dozentenmodul/src/main/java/wizards/ImageUploadPage.java)10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java11
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ACache.java (renamed from dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ACache.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageCache.java (renamed from dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ImageCache.java)4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/MetaDataCache.java (renamed from dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/MetaDataCache.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/OrganizationCache.java (renamed from dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/OrganizationCache.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java (renamed from dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/Session.java)5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/CheckIntegrity.java (renamed from dozentenmodul/src/main/java/util/CheckIntegrity.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/FormatHelper.java (renamed from dozentenmodul/src/main/java/util/FormatHelper.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/News.java (renamed from dozentenmodul/src/main/java/util/News.java)2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/OpenLinks.java (renamed from dozentenmodul/src/main/java/util/OpenLinks.java)4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java (renamed from dozentenmodul/src/main/java/config/ConfigProxy.java)6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java (renamed from dozentenmodul/src/main/java/util/ResourceLoader.java)5
39 files changed, 414 insertions, 595 deletions
diff --git a/dozentenmodul/src/main/java/ftp/DownloadTask.java b/dozentenmodul/src/main/java/ftp/DownloadTask.java
deleted file mode 100644
index 481ea75a..00000000
--- a/dozentenmodul/src/main/java/ftp/DownloadTask.java
+++ /dev/null
@@ -1,315 +0,0 @@
-package ftp;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.RandomAccessFile;
-import java.nio.charset.StandardCharsets;
-import java.util.Map;
-
-import javax.swing.JOptionPane;
-import javax.swing.SwingWorker;
-
-import org.openslx.bwlp.thrift.iface.*;
-
-
-import org.apache.commons.io.FileUtils;
-import org.apache.log4j.Logger;
-import org.apache.thrift.TException;
-import org.openslx.filetransfer.DataReceivedCallback;
-import org.openslx.filetransfer.Downloader;
-import org.openslx.filetransfer.FileRange;
-import org.openslx.filetransfer.WantRangeCallback;
-import org.openslx.thrifthelper.ThriftManager;
-
-import util.ResourceLoader;
-
-/**
- * Execute file download in a background thread and update the progress.
- *
- * @author www.codejava.net
- *
- */
-public class DownloadTask extends SwingWorker<Void, Void> {
-
- /**
- * Logger instance for this class.
- */
- private final static Logger LOGGER = Logger.getLogger(DownloadTask.class);
-
- private static final double UPDATE_INTERVAL_SECONDS = 0.6;
- private static final double UPDATE_INTERVAL_MS = UPDATE_INTERVAL_SECONDS * 1000;
- private static final double BYTES_PER_MIB = 1024 * 1024;
- private static final long CHUNK_SIZE = 16 * 1024 * 1024;
-
- private final String host;
- private final int port;
- private final String downloadToken;
- private final String saveDir;
- private final long fileSize;
- private boolean success = false;
-
- public DownloadTask(String host, int port, String downloadToken, String saveDir, long fileSize) {
- this.host = host;
- this.port = port;
- this.downloadToken = downloadToken;
- this.saveDir = saveDir;
- this.fileSize = fileSize;
- }
-
- class Callbacks implements WantRangeCallback, DataReceivedCallback {
- // initialize the counters needed for speed calculations
- private long currentRequestedOffset = -1;
- private long totalBytesRead = 0;
- private long lastUpdate = 0;
- private long lastBytes = 0;
- private long currentBytes = 0;
- private final RandomAccessFile file;
-
- public Callbacks(RandomAccessFile file) {
- this.file = file;
- }
-
- @Override
- public FileRange get() {
- if (currentRequestedOffset == -1)
- currentRequestedOffset = 0;
- else
- currentRequestedOffset += CHUNK_SIZE;
- if (currentRequestedOffset >= fileSize)
- return null;
- long end = currentRequestedOffset + CHUNK_SIZE;
- if (end > fileSize)
- end = fileSize;
- return new FileRange(currentRequestedOffset, end);
- }
-
- @Override
- public boolean dataReceived(final long fileOffset, final int dataLength, final byte[] data) {
- try {
- file.seek(fileOffset);
- file.write(data, 0, dataLength);
- } catch (Exception e) {
- LOGGER.error("Could not write to file at offset " + fileOffset, e);
- return false;
- }
- currentBytes += dataLength;
- totalBytesRead += dataLength;
- final long now = System.currentTimeMillis();
- if (lastUpdate + UPDATE_INTERVAL_MS < now) {
- final int percentCompleted = (int) ((totalBytesRead * 100) / fileSize);
- setProgress(percentCompleted);
- lastBytes = (lastBytes * 2 + currentBytes) / 3;
- final double speed = lastBytes / UPDATE_INTERVAL_SECONDS;
- firePropertyChange("speed", 0, speed / BYTES_PER_MIB);
- firePropertyChange("bytesread", 0, totalBytesRead);
- lastUpdate = now;
- currentBytes = 0;
- }
- return true;
- }
-
- }
-
- /**
- * Executed in background thread
- */
- @Override
- protected Void doInBackground() throws Exception {
- boolean ret = false;
- // show filesize in the GUI
- firePropertyChange("filesize", 0, fileSize);
-
- Downloader download = null;
- RandomAccessFile file = null;
- try {
- download = new Downloader(host, port, null, downloadToken); // TODO: SSL
- try {
- file = new RandomAccessFile(new File(saveDir), "rw");
- } catch (Exception e2) {
- JOptionPane.showMessageDialog(null, "Could not open destination file:\n" + saveDir + "\n"
- + e2.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
- e2.printStackTrace();
- setProgress(0);
- return null;
- }
-
- Callbacks cb = new Callbacks(file);
-
- ret = download.download(cb, cb);
- } finally {
- if (file != null) {
- try {
- file.close();
- } catch (Exception e) {
- }
- }
- if (download != null)
- download.close(null);
- }
-
- // if the download succeeded, set the progress to 100% manually again here to make
- // sure the GUI knows about it.
- if (ret) {
- setProgress(100);
- firePropertyChange("bytesread", 0, fileSize);
- firePropertyChange("success", false, true);
- success = true;
- }
-
- return null;
- }
-
- /**
- * Executed in Swing's event dispatching thread
- */
- @Override
- protected void done() {
- if (isCancelled())
- return;
- if (success) {
- LOGGER.info("Datei erfolgreich heruntergeladen.");
- String vmxResult = "";
- vmxResult = generateVmx() ? "Passende VMX generiert." : "Keine passende VMX generiert!";
- JOptionPane.showMessageDialog(null, "Datei erfolgreich heruntergeladen. " + vmxResult, "Message",
- JOptionPane.INFORMATION_MESSAGE);
- } else {
- LOGGER.error("Datei wurde unvollständig heruntergeladen.");
- JOptionPane.showMessageDialog(null,
- "Datei wurde unvollständig heruntergeladen. Bitte wiederholen.", "Message",
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
-
- /**
- * Helper to generate the vmx for the downloaded image
- * TODO: Not really related to DownloadTask...
- *
- * @return true|false indicating the success of the file creation
- */
- private boolean generateVmx() {
- return false;
-
- /* BROKEN CODE - FIXME class imports
- String vmxTemplate = ResourceLoader.getTextFile("/txt/vmx_template");
- // TODO: sanity checks on vmxTemplate would be good here... just to be safe
-
- // now we replace the placeholder variables with the real data
- // for this, we first need to get the image information from the server
- LOGGER.debug("Image's ID: " + Image.ImageId);
- Map<String, String> imageData = null;
-
- try {
- imageData = ThriftManager.getSatClient().getImageData(Image.ImageId, Image.Version,
- SessionData.authToken);
- } catch (TException e) {
- LOGGER.error("Thrift exception during transfer, see trace: ", e);
- return false;
- }
-
- // sanity check, shouldn't happen.
- if (imageData == null) {
- LOGGER.error("Could not query the image information from the server!");
- LOGGER.error("Image's ID: " + Image.ImageId);
- LOGGER.error("Image's version: " + Image.Version);
- return false;
- }
-
-
- int hardwareVersion = extractHardwareVersion(saveDir + File.separator
- + imageData.get("path").replaceFirst("^prod/", ""));
- if (hardwareVersion == 0) {
- LOGGER.error("'extractHardwareVersion' returned 0 indicating some problem. See logs.");
- LOGGER.error("Falling back to default hardware version of '10'.");
- hardwareVersion = 10;
- }
- // TODO: sanity checks on the content of imageData would be good here...
- // use the information we received about the image
- vmxTemplate = vmxTemplate.replace("%VM_DISPLAY_NAME%", imageData.get("name"));
- vmxTemplate = vmxTemplate.replace("%VM_GUEST_OS%", imageData.get("os"));
- vmxTemplate = vmxTemplate.replace("%VM_CPU_COUNT%", imageData.get("cpu"));
- vmxTemplate = vmxTemplate.replace("%VM_RAM_SIZE%",
- String.valueOf(Integer.valueOf(imageData.get("ram")) * 1024));
- vmxTemplate = vmxTemplate.replace("%VM_DISK_PATH%", imageData.get("path").replaceFirst("^prod/", ""));
- vmxTemplate = vmxTemplate.replace("%VM_HW_VERSION%", String.valueOf(hardwareVersion));
-
- // build filename for the vmx, basicly the same as the path of the vmdk
- // just without the leading "prod/" and "vmx" instead of "vmdk" at the end.
- String targetFilename = saveDir + File.separator
- + imageData.get("path").replaceFirst("^prod/", "").replaceFirst("\\.vmdk$", "") + ".vmx";
- try {
- // try to write it to file
- FileUtils.writeStringToFile(new File(targetFilename), vmxTemplate, StandardCharsets.UTF_8);
- } catch (IOException e) {
- LOGGER.error("Could not write vmx-template to '" + targetFilename + "'. See trace: ", e);
- return false;
- }
- return true;
- * BROKEN CODE - FIXME
- */
- }
-
- /**
- * Helper to extract the hardware version of the VMDK file by inspecting its
- * content.
- *
- * @return value of hardware version as integer. A return value of 0
- * indicates
- * an error.
- */
- private int extractHardwareVersion(String path) {
- BufferedReader br = null;
- try {
- try {
- br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
- String line;
- // first 4 characters of a VMDK file start with 'KDMV'
- // first lets check if this is the case
- line = br.readLine();
- if (!line.subSequence(0, 4).equals("KDMV")) {
- LOGGER.error("Did not see 'KDMV' as first chars of the VMDK! Returning 0.");
- LOGGER.debug("First line was: " + line);
- LOGGER.debug("First 4 characters of it: " + line.subSequence(0, 4));
- return 0;
- }
- // only read a maximum of 25 lines, just in case...
- int round = 0;
- while ((line = br.readLine()) != null && round < 25) {
- if (line.startsWith("ddb.virtualHWVersion")) {
- String[] tmp = line.split("=");
- // we should get 2 strings only after the split, lets be sure
- if (tmp.length != 2) {
- LOGGER.debug("Splitting returned more than 2 parts, this should not happen!");
- return 0;
- }
- int candidate = Integer.parseInt(tmp[1].trim().replace("\"", ""));
- LOGGER.debug("Considering hardware version: " + candidate);
- if (candidate > 0) {
- LOGGER.debug("Valid value of the candidate. Using hardware version of: "
- + candidate);
- return candidate;
- } else {
- LOGGER.error("Candidate is not > 0! Returning 0.");
- return 0;
- }
- }
- round++;
- }
- LOGGER.error("Failed to find hardware version. Tried " + round + " rounds.");
- } catch (NumberFormatException e) {
- // Not a number?
- return 0;
- } finally {
- br.close();
- }
- } catch (FileNotFoundException e) {
- LOGGER.debug("File not found, see trace: ", e);
- } catch (IOException e) {
- LOGGER.debug("I/O Exception, see trace: ", e);
- }
- return 0;
- }
-}
diff --git a/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java b/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java
deleted file mode 100644
index 45929614..00000000
--- a/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package gui.helper;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-
-import javax.swing.AbstractButton;
-import javax.swing.JTable;
-
-public class ColumnSelector implements ItemListener {
-
- private final JTable table;
- private final Integer[] columns;
-
- public ColumnSelector(JTable table, Integer... columns) {
- this.table = table;
- this.columns = columns;
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (!(e.getSource() instanceof AbstractButton))
- return;
- Boolean checked = e.getStateChange() == ItemEvent.SELECTED;
- for (int x = 0, y = table.getRowCount(); x < y; x++) {
- for (Integer col : columns) {
- table.setValueAt(checked, x, col);
- }
- }
- }
-
-}
diff --git a/dozentenmodul/src/main/java/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
index 688ba81f..c9fc369e 100644
--- a/dozentenmodul/src/main/java/App.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
@@ -1,5 +1,4 @@
-import gui.GuiManager;
-
+package org.openslx.dozmod;
import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
@@ -12,9 +11,8 @@ import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.spi.LoggingEvent;
-
-import config.Config;
-import config.ConfigProxy;
+import org.openslx.dozmod.gui.helper.GuiManager;
+import org.openslx.dozmod.util.ProxyConfigurator;
public class App {
@@ -105,7 +103,7 @@ public class App {
// initialise the proxy settings
try {
- ConfigProxy.init();
+ ProxyConfigurator.init();
} catch (IOException e) {
LOGGER.error("IOException when trying to initialise the proxy, see trace: ", e);
}
diff --git a/dozentenmodul/src/main/java/config/Config.java b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
index cda8dab2..80a50685 100644
--- a/dozentenmodul/src/main/java/config/Config.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
@@ -1,5 +1,4 @@
-package config;
-
+package org.openslx.dozmod;
import java.io.File;
import java.io.IOException;
@@ -23,19 +22,19 @@ public class Config {
/**
* The main configuration object is of type Wini
* It contains the content of the config.ini as
- * determined in the init() function.
+ * determined in the init() function.
*/
private static Wini ini = null;
/**
* Initializes the class by determining the path
- * to the config.ini on the system and setting the
+ * to the config.ini on the system and setting the
* private creating the ini member from that file.
*
- * This function will make a distinction between
- * Linux and Windows OS's, as the standard paths
+ * This function will make a distinction between
+ * Linux and Windows OS's, as the standard paths
* for configuration files obviously differ.
- *
+ *
* @throws IOException
*/
public static void init() throws IOException {
@@ -45,9 +44,9 @@ public class Config {
File configFile = null;
// Determine OS
- String OSName = System.getProperty("os.name").toLowerCase();
- LOGGER.info("Machine's OS: " + OSName);
- if (OSName.contains("windows")) {
+ String osName = System.getProperty("os.name").toLowerCase();
+ LOGGER.info("Machine's OS: " + osName);
+ if (osName.contains("windows")) {
// Windows machine. Use the environment variable 'APPDATA' which
// should point to a path similar to:
// C:\Users\<user>\AppData\Roaming
@@ -55,25 +54,25 @@ public class Config {
if (!appDataPath.isEmpty()) {
configPath = appDataPath + "\\bwSuite\\config.ini";
} else {
- // APPDATA was empty, let's build it ourselves...
+ // APPDATA was empty, let's guess
LOGGER.warn("APPDATA is empty.");
- configPath = System.getProperty("user.home") + "\\AppData\\Roaming\\bwSuite\\config.ini";
+ configPath = System.getProperty("user.home") + "\\AppData\\Roaming\\bwSuite\\config.ini";
}
-
- } else if (OSName.contains("linux")) {
- configPath=System.getProperty("user.home") + "/.config/bwSuite/config.ini";
+ } else if (osName.contains("linux")) {
+ configPath = System.getProperty("user.home") + "/.config/bwSuite/config.ini";
} else {
- // Not Windows nor Linux, TODO MacOS Support?
- configPath = null;
+ // Not Windows nor Linux, try fallback to relative path
+ // TODO MacOS Support?
+ configPath = "." + File.separatorChar + "bwSuite" + File.separatorChar + "config.ini";
}
-
+
// Check if we got a path
- if (!(configPath.isEmpty()||configPath == null)) {
+ if (!(configPath.isEmpty() || configPath == null)) {
configFile = new File(configPath);
} else {
throw new IOException("Could not determine the path to the config file.");
}
-
+
// Check if the directory exists.
if (!configFile.getParentFile().exists()) {
LOGGER.info("Folder " + configFile.getParentFile() + " does not exist, creating it.");
@@ -82,14 +81,14 @@ public class Config {
throw new IOException("Could not create '" + configFile.getParentFile() + "'.");
}
}
-
+
// Check if the file already exists
if (!configFile.exists()) {
// Does not, create it
configFile.createNewFile();
// Check if file is writeable
- if(configFile.canWrite()) {
+ if (configFile.canWrite()) {
ini = new Wini(configFile);
LOGGER.info("Creating '" + configFile + "'...");
// write default configuration options and values
@@ -101,7 +100,7 @@ public class Config {
ini.put("main", "upload_path", "");
ini.put("main", "identity_provider", "");
ini.store();
-
+
} else {
throw new IOException("Can not write to '" + configFile + "'. Do you have permissions?");
}
@@ -113,6 +112,7 @@ public class Config {
/**
* Query the path of the configuration file
+ *
* @return path to the configuration file
*/
public static String getPath() {
@@ -121,104 +121,137 @@ public class Config {
else
return null;
}
+
/**
* Query the value of 'BillOfRights' from the configuration file.
- * @return true if the user already accepted bill of rights, false otherwise.
+ *
+ * @return true if the user already accepted bill of rights, false
+ * otherwise.
*/
public static boolean getDisclaimerAgreement() {
return getBoolean("main", "disclaimer_agreement", false);
}
+
/**
* Query the value of 'vmware' from the configuration file.
- * @return true if the user already accepted vmware license, false otherwise.
+ *
+ * @return true if the user already accepted vmware license, false
+ * otherwise.
*/
public static boolean getVmwareLicenseAgreement() {
return getBoolean("main", "vmware_license_agreement", false);
}
+
/**
* Query the value of 'Benutzername' from the configuration file.
+ *
* @return username if saved, an empty string otherwise.
*/
public static String getUsername() {
return getString("main", "username", "");
}
+
/**
* Query the value of 'Letzter Downloadpfad' from the configuration file.
- * @return last download path if saved, the path to the user's home otherwise.
+ *
+ * @return last download path if saved, the path to the user's home
+ * otherwise.
*/
public static String getDownloadPath() {
return getString("main", "download_path", System.getProperty("user.home"));
}
+
/**
* Query the value of 'Letzter Uploadpfad' from the configuration file.
+ *
* @return last upload path if saved, the path to the user's home otherwise.
*/
public static String getUploadPath() {
return getString("main", "upload_path", System.getProperty("user.home"));
}
+
/**
* Query the IdP of the configuration file
+ *
* @return stored IdP
*/
public static String getIdentityProvider() {
- return getString("main", "identity_provider", "");
+ return getString("main", "identity_provider", "");
}
+
/**
* Query the authentication method of the configuration file
+ *
* @return stored IdP
*/
public static String getAuthenticationMethod() {
- return getString("main", "auth_method", "bwlp");
+ return getString("main", "auth_method", "bwlp");
}
/**
* Sets the value of 'BillOfRights' in the configuration file to 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setDisclaimerAgreement(boolean value) {
return setBoolean("main", "disclaimer_agreement", value);
}
+
/**
* Sets the value of 'vmware' in the configuration file to 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setVmwareLicenseAgreement(boolean value) {
return setBoolean("main", "vmware_license_agreement", value);
}
+
/**
* Sets the value of 'Benutzername' in the configuration file to 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setUsername(String value) {
return setString("main", "username", value);
}
+
/**
- * Sets the value of 'Letzter Downloadpfad' in the configuration file to 'value'
+ * Sets the value of 'Letzter Downloadpfad' in the configuration file to
+ * 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setDownloadPath(String value) {
return setString("main", "download_path", value);
}
+
/**
- * Sets the value of "Letzter Uploadpfad" in the configuration file to 'value'
+ * Sets the value of "Letzter Uploadpfad" in the configuration file to
+ * 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setUploadPath(String value) {
return setString("main", "upload_path", value);
}
+
/**
* Sets the value of "IdP" in the configuration file to 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setIdentityProvider(String value) {
return setString("main", "identity_provider", value);
}
+
/**
- * Sets the value of the selected authentication method in the configuration file to 'value'
+ * Sets the value of the selected authentication method in the configuration
+ * file to 'value'
+ *
* @return true if it succeeded, false otherwise
*/
public static boolean setAuthenticationMethod(String value) {
- return setString("main","auth_method", value);
+ return setString("main", "auth_method", value);
}
/**
@@ -235,15 +268,15 @@ public class Config {
return false;
}
}
-
+
/**
* Gets the boolean from the given 'key' in the given 'section'.
* If nothing is found, return the given 'defaultValue'
- *
+ *
* @param section section to search the key in
* @param key key to query in that section
* @param defaultValue default value to be returned, if none is found.
- * @return
+ * @return
*/
private static boolean getBoolean(String section, String key, Boolean defaultValue) {
if (ini.containsKey(section) && ini.get(section).containsKey(key)) {
@@ -252,15 +285,16 @@ public class Config {
return defaultValue;
}
}
-
+
/**
* Gets the string from the given 'key' in the given 'section'
* If nothing is found, return the given 'defaultValue'
*
- * @param section section of the configuration file to search for
+ * @param section section of the configuration file to search for
* @param key key to lookup in the section
* @param defaultValue default value to return if none is found in the file
- * @return value of 'key' in 'section' if it exists, 'defaultValue' otherwise
+ * @return value of 'key' in 'section' if it exists, 'defaultValue'
+ * otherwise
*/
private static String getString(String section, String key, String defaultValue) {
if (ini.containsKey(section) && ini.get(section).containsKey(key)) {
@@ -269,11 +303,12 @@ public class Config {
return defaultValue;
}
}
+
/**
* Sets the given 'key' in the given 'section' to 'value'.
* Restricted to boolean.
- *
- * @param section section of the configuration file
+ *
+ * @param section section of the configuration file
* @param key key to set
* @param value value to assign to key
* @return true if it succeeded, false otherwise
@@ -281,12 +316,12 @@ public class Config {
private static boolean setBoolean(String section, String key, boolean value) {
return ini.put(section, key, value) != null;
}
-
+
/**
* Sets the given 'key' in the given 'section' to 'value'.
* Restricted to string.
- *
- * @param section section of the configuration file
+ *
+ * @param section section of the configuration file
* @param key key to set
* @param value value to assign to key
* @return true if it succeeded, false otherwise
@@ -295,5 +330,4 @@ public class Config {
return ini.put(section, key, value) != null;
}
-
}
diff --git a/dozentenmodul/src/main/java/auth/BWIDMAuthenticator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWIDMAuthenticator.java
index 40c1d2eb..ece74088 100644
--- a/dozentenmodul/src/main/java/auth/BWIDMAuthenticator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWIDMAuthenticator.java
@@ -1,4 +1,4 @@
-package auth;
+package org.openslx.dozmod.authentication;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -11,13 +11,11 @@ import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.TAuthenticationException;
import org.openslx.bwlp.thrift.iface.TInvalidTokenException;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.authentication.ShibbolethECP.ReturnCode;
import org.openslx.thrifthelper.ThriftManager;
import com.google.gson.JsonSyntaxException;
-import util.ShibbolethECP;
-import util.ShibbolethECP.ReturnCode;
-
/**
* @author Jonathan Bauer
*
diff --git a/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWLPAuthenticator.java
index 66c31d73..7a9e718d 100644
--- a/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BWLPAuthenticator.java
@@ -1,4 +1,4 @@
-package auth;
+package org.openslx.dozmod.authentication;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
@@ -6,10 +6,9 @@ import org.openslx.bwlp.thrift.iface.SessionData;
import org.openslx.bwlp.thrift.iface.TAuthenticationException;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.authentication.ShibbolethECP.ReturnCode;
import org.openslx.thrifthelper.ThriftManager;
-import util.ShibbolethECP.ReturnCode;
-
/**
* @author Jonathan Bauer
*
diff --git a/dozentenmodul/src/main/java/auth/BaseAuthenticator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BaseAuthenticator.java
index f22577d8..60602a3f 100644
--- a/dozentenmodul/src/main/java/auth/BaseAuthenticator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/BaseAuthenticator.java
@@ -1,9 +1,9 @@
-package auth;
+package org.openslx.dozmod.authentication;
import org.openslx.bwlp.thrift.iface.TAuthenticationException;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.authentication.ShibbolethECP.ReturnCode;
-import util.ShibbolethECP.ReturnCode;
import edu.kit.scc.dei.ecplean.ECPAuthenticationException;
/**
diff --git a/dozentenmodul/src/main/java/util/ServiceProviderResponse.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java
index 37b93b33..f222efb7 100644
--- a/dozentenmodul/src/main/java/util/ServiceProviderResponse.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.authentication;
import java.util.HashMap;
diff --git a/dozentenmodul/src/main/java/util/ShibbolethECP.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java
index 7844a51e..0998c8af 100644
--- a/dozentenmodul/src/main/java/util/ShibbolethECP.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.authentication;
import java.io.IOException;
import java.net.MalformedURLException;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/DownloadTask.java b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/DownloadTask.java
new file mode 100644
index 00000000..aebaf732
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/DownloadTask.java
@@ -0,0 +1,171 @@
+package org.openslx.dozmod.filetransfer;
+
+import java.io.File;
+import java.io.RandomAccessFile;
+
+import javax.swing.JOptionPane;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import org.openslx.filetransfer.DataReceivedCallback;
+import org.openslx.filetransfer.Downloader;
+import org.openslx.filetransfer.FileRange;
+import org.openslx.filetransfer.WantRangeCallback;
+
+/**
+ * Execute file download in a background thread and update the progress.
+ *
+ * @author www.codejava.net
+ *
+ */
+public class DownloadTask extends SwingWorker<Void, Void> {
+
+ /**
+ * Logger instance for this class.
+ */
+ private final static Logger LOGGER = Logger.getLogger(DownloadTask.class);
+
+ private static final double UPDATE_INTERVAL_SECONDS = 0.6;
+ private static final double UPDATE_INTERVAL_MS = UPDATE_INTERVAL_SECONDS * 1000;
+ private static final double BYTES_PER_MIB = 1024 * 1024;
+ private static final long CHUNK_SIZE = 16 * 1024 * 1024;
+
+ private final String host;
+ private final int port;
+ private final String downloadToken;
+ private final String saveDir;
+ private final long fileSize;
+ private boolean success = false;
+
+ public DownloadTask(String host, int port, String downloadToken, String saveDir, long fileSize) {
+ this.host = host;
+ this.port = port;
+ this.downloadToken = downloadToken;
+ this.saveDir = saveDir;
+ this.fileSize = fileSize;
+ }
+
+ class Callbacks implements WantRangeCallback, DataReceivedCallback {
+ // initialize the counters needed for speed calculations
+ private long currentRequestedOffset = -1;
+ private long totalBytesRead = 0;
+ private long lastUpdate = 0;
+ private long lastBytes = 0;
+ private long currentBytes = 0;
+ private final RandomAccessFile file;
+
+ public Callbacks(RandomAccessFile file) {
+ this.file = file;
+ }
+
+ @Override
+ public FileRange get() {
+ if (currentRequestedOffset == -1)
+ currentRequestedOffset = 0;
+ else
+ currentRequestedOffset += CHUNK_SIZE;
+ if (currentRequestedOffset >= fileSize)
+ return null;
+ long end = currentRequestedOffset + CHUNK_SIZE;
+ if (end > fileSize)
+ end = fileSize;
+ return new FileRange(currentRequestedOffset, end);
+ }
+
+ @Override
+ public boolean dataReceived(final long fileOffset, final int dataLength, final byte[] data) {
+ try {
+ file.seek(fileOffset);
+ file.write(data, 0, dataLength);
+ } catch (Exception e) {
+ LOGGER.error("Could not write to file at offset " + fileOffset, e);
+ return false;
+ }
+ currentBytes += dataLength;
+ totalBytesRead += dataLength;
+ final long now = System.currentTimeMillis();
+ if (lastUpdate + UPDATE_INTERVAL_MS < now) {
+ final int percentCompleted = (int) ((totalBytesRead * 100) / fileSize);
+ setProgress(percentCompleted);
+ lastBytes = (lastBytes * 2 + currentBytes) / 3;
+ final double speed = lastBytes / UPDATE_INTERVAL_SECONDS;
+ firePropertyChange("speed", 0, speed / BYTES_PER_MIB);
+ firePropertyChange("bytesread", 0, totalBytesRead);
+ lastUpdate = now;
+ currentBytes = 0;
+ }
+ return true;
+ }
+
+ }
+
+ /**
+ * Executed in background thread
+ */
+ @Override
+ protected Void doInBackground() throws Exception {
+ boolean ret = false;
+ // show filesize in the GUI
+ firePropertyChange("filesize", 0, fileSize);
+
+ Downloader download = null;
+ RandomAccessFile file = null;
+ try {
+ download = new Downloader(host, port, null, downloadToken); // TODO: SSL
+ try {
+ file = new RandomAccessFile(new File(saveDir), "rw");
+ } catch (Exception e2) {
+ JOptionPane.showMessageDialog(null, "Could not open destination file:\n" + saveDir + "\n"
+ + e2.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
+ e2.printStackTrace();
+ setProgress(0);
+ return null;
+ }
+
+ Callbacks cb = new Callbacks(file);
+
+ ret = download.download(cb, cb);
+ } finally {
+ if (file != null) {
+ try {
+ file.close();
+ } catch (Exception e) {
+ }
+ }
+ if (download != null)
+ download.close(null);
+ }
+
+ // if the download succeeded, set the progress to 100% manually again here to make
+ // sure the GUI knows about it.
+ if (ret) {
+ setProgress(100);
+ firePropertyChange("bytesread", 0, fileSize);
+ firePropertyChange("success", false, true);
+ success = true;
+ }
+
+ return null;
+ }
+
+ /**
+ * Executed in Swing's event dispatching thread
+ */
+ @Override
+ protected void done() {
+ if (isCancelled())
+ return;
+ if (success) {
+ LOGGER.info("Datei erfolgreich heruntergeladen.");
+ String vmxResult = "";
+ JOptionPane.showMessageDialog(null, "Datei erfolgreich heruntergeladen. " + vmxResult, "Message",
+ JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ LOGGER.error("Datei wurde unvollständig heruntergeladen.");
+ JOptionPane.showMessageDialog(null,
+ "Datei wurde unvollständig heruntergeladen. Bitte wiederholen.", "Message",
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/ftp/UploadTask.java b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java
index 7babb5f6..c240c5d5 100644
--- a/dozentenmodul/src/main/java/ftp/UploadTask.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java
@@ -1,4 +1,4 @@
-package ftp;
+package org.openslx.dozmod.filetransfer;
import java.io.File;
import java.io.IOException;
@@ -6,8 +6,6 @@ import java.io.IOException;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
-import org.openslx.bwlp.thrift.iface.*;
-
import org.apache.log4j.Logger;
import org.openslx.filetransfer.UploadStatusCallback;
import org.openslx.filetransfer.Uploader;
diff --git a/dozentenmodul/src/main/java/gui/controls/BlockProgressBar.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/BlockProgressBar.java
index 94fd9ffd..b8680607 100644
--- a/dozentenmodul/src/main/java/gui/controls/BlockProgressBar.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/BlockProgressBar.java
@@ -1,4 +1,4 @@
-package gui.controls;
+package org.openslx.dozmod.gui.control;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
diff --git a/dozentenmodul/src/main/java/gui/GuiManager.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java
index 4df4b6a0..b79f306d 100644
--- a/dozentenmodul/src/main/java/gui/GuiManager.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java
@@ -1,4 +1,4 @@
-package gui;
+package org.openslx.dozmod.gui.helper;
import org.apache.log4j.Logger;
import org.eclipse.swt.SWT;
@@ -122,7 +122,7 @@ public abstract class GuiManager {
// Set layout for the mainshell, items added to the shell should get a gridData
mainShell.setLayout(new GridLayout(1, true));
- addContent(new gui.core.LoginGUI(mainShell));
+ addContent(new org.openslx.dozmod.gui.window.LoginWindow(mainShell));
// center the window on the primary monitor
Monitor primary = display.getPrimaryMonitor();
diff --git a/dozentenmodul/src/main/java/util/MessageType.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java
index 294e28d6..b0f55a5d 100644
--- a/dozentenmodul/src/main/java/util/MessageType.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.gui.helper;
import javax.swing.JOptionPane;
diff --git a/dozentenmodul/src/main/java/gui/helper/VMColumns.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java
index 9e73c307..5a8ca579 100644
--- a/dozentenmodul/src/main/java/gui/helper/VMColumns.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java
@@ -1,19 +1,19 @@
-package gui.helper;
+package org.openslx.dozmod.gui.helper;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
-import org.openslx.bwlp.dozmod.thrift.MetaDataCache;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
-import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.thrift.MetaDataCache;
+public final class TableHelper {
+ private TableHelper() {
+ }
-public final class VMColumns {
- private VMColumns(){};
-
- private static void createColumn(TableViewer table, String colName, int width, ColumnLabelProvider provider){
+ private static void createColumn(TableViewer table, String colName, int width,
+ ColumnLabelProvider provider) {
TableViewerColumn col = new TableViewerColumn(table, SWT.NONE);
col.getColumn().setWidth(width);
col.getColumn().setText(colName);
@@ -23,9 +23,10 @@ public final class VMColumns {
/**
* create the columns for the table in the VM mainwindow
+ *
* @param table the tableViewer
*/
- public static void createVMTableColumns(TableViewer table){
+ public static void createImageTableColumns(TableViewer table) {
createColumn(table, "Name", 150, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -34,16 +35,12 @@ public final class VMColumns {
}
});
-
-
createColumn(table, "OS", 90, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
- // TODO remove and uncomment when deploying
ImageSummaryRead image = (ImageSummaryRead) element;
- //OperatingSystem os = MetaDataCache.getOsById(image.getOsId());
-
- OperatingSystem os = null ;
+ OperatingSystem os = MetaDataCache.getOsById(image.getOsId());
+
if (os == null) {
return "Unknown";
} else {
@@ -75,7 +72,6 @@ public final class VMColumns {
return String.valueOf(image.getFileSize());
}
});
-
};
}
diff --git a/dozentenmodul/src/main/java/gui/core/DisclaimerGUI.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java
index 5a53150e..6db29f15 100644
--- a/dozentenmodul/src/main/java/gui/core/DisclaimerGUI.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java
@@ -1,19 +1,18 @@
-package gui.core;
-
-import gui.GuiManager;
+package org.openslx.dozmod.gui.window;
import org.apache.log4j.Logger;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
+import org.openslx.dozmod.Config;
+import org.openslx.dozmod.gui.helper.GuiManager;
+import org.openslx.dozmod.gui.window.layout.DisclaimerWindowLayout;
-import config.Config;
-
-public class DisclaimerGUI extends DisclaimerComposite{
+public class DisclaimerWindow extends DisclaimerWindowLayout{
- private final static Logger LOGGER = Logger.getLogger(DisclaimerGUI.class);
+ private final static Logger LOGGER = Logger.getLogger(DisclaimerWindow.class);
- public DisclaimerGUI(final Shell mainShell) {
+ public DisclaimerWindow(final Shell mainShell) {
super(mainShell);
// function for agreement checkbox
@@ -33,10 +32,7 @@ public class DisclaimerGUI extends DisclaimerComposite{
LOGGER.error("Could not set the agreement to the disclaimer in '" + Config.getPath() + "'!");
Config.store();
// now check the config to see if the user has agreed to vmware stuff
- if (!Config.getVmwareLicenseAgreement())
- GuiManager.addContent(new VMWareInfoGUI(getShell()));
- else
- GuiManager.addContent(new MainWindowComposite(getShell()));
+ GuiManager.addContent(new VirtualizerNoticeWindow(getShell()));
}
});
}
diff --git a/dozentenmodul/src/main/java/gui/core/LoginGUI.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
index 795ccc4b..62860fb5 100644
--- a/dozentenmodul/src/main/java/gui/core/LoginGUI.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
@@ -1,4 +1,4 @@
-package gui.core;
+package org.openslx.dozmod.gui.window;
import java.util.Collections;
import java.util.Comparator;
@@ -11,27 +11,29 @@ import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
-import org.openslx.bwlp.dozmod.thrift.OrganizationCache;
import org.openslx.bwlp.thrift.iface.Organization;
import org.openslx.bwlp.thrift.iface.TAuthenticationException;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.Config;
+import org.openslx.dozmod.authentication.BWIDMAuthenticator;
+import org.openslx.dozmod.authentication.BWLPAuthenticator;
+import org.openslx.dozmod.authentication.BaseAuthenticator.AuthenticatorCallback;
+import org.openslx.dozmod.authentication.ShibbolethECP.ReturnCode;
+import org.openslx.dozmod.gui.helper.GuiManager;
+import org.openslx.dozmod.gui.window.layout.LoginWindowLayout;
+import org.openslx.dozmod.gui.window.layout.MainWindowLayout;
+import org.openslx.dozmod.thrift.OrganizationCache;
import org.openslx.thrifthelper.ThriftManager;
-import util.ShibbolethECP.ReturnCode;
-import auth.BWIDMAuthenticator;
-import auth.BWLPAuthenticator;
-import auth.BaseAuthenticator.AuthenticatorCallback;
-import config.Config;
import edu.kit.scc.dei.ecplean.ECPAuthenticationException;
-import gui.GuiManager;
/**
* @author Jonathan Bauer
*
*/
-public class LoginGUI extends LoginComposite {
+public class LoginWindow extends LoginWindowLayout {
- private final static Logger LOGGER = Logger.getLogger(LoginGUI.class);
+ private final static Logger LOGGER = Logger.getLogger(LoginWindow.class);
// text constants
private final String NO_USERNAME = "Kein Benutzername angegeben!";
@@ -49,7 +51,7 @@ public class LoginGUI extends LoginComposite {
*
* @param mainShell
*/
- public LoginGUI(final Shell mainShell) {
+ public LoginWindow(final Shell mainShell) {
// call the constructor of the superclass
super(mainShell);
@@ -305,15 +307,15 @@ public class LoginGUI extends LoginComposite {
private void postSuccessfulLogin() {
LOGGER.info(loginType.getTag() + " succeeded.");
+ // TODO HACK HACK
ThriftManager.setSatelliteAddress( "132.230.8.113" );
// now read the config to see if the user already agreed to the disclaimer
if (!Config.getDisclaimerAgreement())
- GuiManager.addContent(new DisclaimerGUI(getShell()));
+ GuiManager.addContent(new DisclaimerWindow(getShell()));
else if (!Config.getVmwareLicenseAgreement())
- GuiManager.addContent(new VMWareInfoGUI(getShell()));
- else
- GuiManager.addContent(new MainWindowComposite(getShell()));
+ GuiManager.addContent(new VirtualizerNoticeWindow(getShell()));
+ // TODO: See MainWindowLayout comments
}
/**
diff --git a/dozentenmodul/src/main/java/gui/core/VMWareInfoGUI.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java
index 74f6ad63..177957bc 100644
--- a/dozentenmodul/src/main/java/gui/core/VMWareInfoGUI.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java
@@ -1,19 +1,17 @@
-package gui.core;
-
-import gui.GuiManager;
+package org.openslx.dozmod.gui.window;
import org.apache.log4j.Logger;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
+import org.openslx.dozmod.Config;
+import org.openslx.dozmod.gui.window.layout.VirtualizerNoticeWindowLayout;
-import config.Config;
-
-public class VMWareInfoGUI extends VMWareInfoComposite {
+public class VirtualizerNoticeWindow extends VirtualizerNoticeWindowLayout {
- private final static Logger LOGGER = Logger.getLogger(VMWareInfoGUI.class);
+ private final static Logger LOGGER = Logger.getLogger(VirtualizerNoticeWindow.class);
- public VMWareInfoGUI(final Shell mainShell) {
+ public VirtualizerNoticeWindow(final Shell mainShell) {
super(mainShell);
// function for agreement checkbox
@@ -23,7 +21,7 @@ public class VMWareInfoGUI extends VMWareInfoComposite {
if (!Config.setVmwareLicenseAgreement(true))
LOGGER.error("Could not set the agreement to the vmware license in '" + Config.getPath() + "'!");
Config.store();
- GuiManager.addContent(new MainWindowComposite(getShell()));
+ // TODO GuiManager.addContent(new MainWindowLayout(getShell()));
}
});
diff --git a/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java
index c4d48a60..37b1bdae 100644
--- a/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java
@@ -1,4 +1,4 @@
-package gui.core;
+package org.openslx.dozmod.gui.window.layout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -11,7 +11,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-public class DisclaimerComposite extends Composite {
+public abstract class DisclaimerWindowLayout extends Composite {
private final String notice = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise";
private final String disclaimer = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \n\n"
@@ -33,9 +33,9 @@ public class DisclaimerComposite extends Composite {
// Buttons
protected Button agreeBox;
- Button continueButton;
+ protected Button continueButton;
- public DisclaimerComposite(final Shell mainShell) {
+ public DisclaimerWindowLayout(final Shell mainShell) {
super(mainShell, SWT.NONE);
diff --git a/dozentenmodul/src/main/java/gui/core/ImageWindowComposite.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
index 6a024e3f..99d97eac 100644
--- a/dozentenmodul/src/main/java/gui/core/ImageWindowComposite.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
@@ -1,9 +1,6 @@
-package gui.core;
+package org.openslx.dozmod.gui.window.layout;
-import gui.GuiManager;
-import gui.helper.VMColumns;
-
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
@@ -30,10 +27,11 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
+import org.openslx.dozmod.gui.helper.GuiManager;
+import org.openslx.dozmod.gui.helper.TableHelper;
+import org.openslx.dozmod.gui.wizard.ImageWizard;
-import wizards.ImageWizard;
-
-public class ImageWindowComposite extends Composite {
+public abstract class ImageListWindowLayout extends Composite {
protected String infoTitleString = "Imageauswahl";
protected String newButtonLabel = "Neu";
@@ -62,7 +60,7 @@ public class ImageWindowComposite extends Composite {
protected String infoTextString = "Hier können Sie images erstellen, bearbeiten und löschen.";
- public ImageWindowComposite(Composite mainShell) {
+ public ImageListWindowLayout(Composite mainShell) {
super(mainShell, SWT.NONE);
this.setLayout(new GridLayout(2, false));
@@ -134,7 +132,7 @@ public class ImageWindowComposite extends Composite {
// The List to be displayed in the viewer
tableViewer.setInput(list);
- VMColumns.createVMTableColumns(tableViewer);
+ TableHelper.createImageTableColumns(tableViewer);
tableViewer.refresh();
diff --git a/dozentenmodul/src/main/java/gui/core/LoginComposite.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java
index d4266adb..b527070e 100644
--- a/dozentenmodul/src/main/java/gui/core/LoginComposite.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java
@@ -1,6 +1,4 @@
-package gui.core;
-
-import gui.GuiManager;
+package org.openslx.dozmod.gui.window.layout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -14,8 +12,9 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.openslx.dozmod.gui.helper.GuiManager;
-public class LoginComposite extends Composite {
+public abstract class LoginWindowLayout extends Composite {
// TODO add ids to use for the authButtons group!
protected static enum LOGIN_TYPE {
@@ -69,7 +68,7 @@ public class LoginComposite extends Composite {
* @param mainShell
* The shell it should be added to
*/
- public LoginComposite(final Shell mainShell) {
+ public LoginWindowLayout(final Shell mainShell) {
super(mainShell, SWT.NONE);
// title for composite
diff --git a/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainWindowLayout.java
index fe24a610..ef4e2676 100644
--- a/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainWindowLayout.java
@@ -1,12 +1,8 @@
-package gui.core;
+package org.openslx.dozmod.gui.window.layout;
-import gui.GuiManager;
-
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -15,8 +11,33 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-
-public class MainWindowComposite extends Composite {
+/*
+ * Structure/workflow should be:
+ *
+ * 1) App starts with Login Window for now [1]
+ *
+ * 2) After login, the main window opens.
+ * 2a) If the disclaimer has not been accepted yet, the main window will open it as a modal window
+ * 2b) Maybe do the same with the "you need vmware" window afterwards, or just show a hint in mainwindow
+ * that would open the vmware info window when clicked.
+ * The disclaimer and vmware info should still be reachable via the menu at any time
+ *
+ * - Clicking vm list or lecture list would show the according list in the same window
+ * - adding/editing lecture/image will open a wizard
+ * - doubleclicking a lecture/image will open a detailed info window
+ *
+ *
+ * GuiManager's add/remove content needs refactoring or needs to be moved, as it's
+ * designed like we only have one main window with changing content, but we
+ * actually have lots of independent windows and wizards.
+ *
+ * (TODO: Make sure it doesn't suck on multiscreen setups)
+ *
+ * [1] Later on we might support a "stay logged in" feature that
+ * will skip the login screen
+ */
+
+public abstract class MainWindowLayout extends Composite {
// text for info for the vms selection
protected String vmInfo = "Infotext VMs.";
@@ -27,7 +48,7 @@ public class MainWindowComposite extends Composite {
protected Button vmButton;
protected Button lecturesButton;
- public MainWindowComposite(final Shell mainShell) {
+ public MainWindowLayout(final Shell mainShell) {
super(mainShell, SWT.NONE);
this.setLayout(new GridLayout(2, true));
@@ -69,43 +90,6 @@ public class MainWindowComposite extends Composite {
lecturesInfoLabel.setText(lecturesInfo);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
lecturesInfoLabel.setLayoutData(gridData);
-
-
- // function for vmButton
- vmButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- clickedVMButton();
- }
- });
-
- // function for lecturesButton
- lecturesButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- clickedLecturesButton();
- }
- });
-
}
-
-
- //
- // logical functions for GUI
- //
-
- /**
- * function for the VMButton
- */
- protected void clickedVMButton() {
- GuiManager.addContent(new ImageWindowComposite(getShell()));
- }
-
- /**
- * function for the lecturesButton
- */
- protected void clickedLecturesButton() {
- System.out.println("lecturesButton clicked!");
- }
}
diff --git a/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java
index d385c60b..bec2dc44 100644
--- a/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java
@@ -1,6 +1,4 @@
-package gui.core;
-
-import gui.GuiManager;
+package org.openslx.dozmod.gui.window.layout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
@@ -11,24 +9,22 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.openslx.dozmod.gui.helper.GuiManager;
-
-public class VMWareInfoComposite extends Composite {
+public abstract class VirtualizerNoticeWindowLayout extends Composite {
private final String title = "Hinweis VMWare Player";
private final String infoText = "Für die Arbeit mit der bwLehrpool Suite wird zwingend ein VMWare Player benötigt. "
+ "Diesen können Sie sich unter folgendem Link kostenfrei downloaden. "
+ "Wenn Sie bereits den VMWare Player oder die VMWare Workstation installiert haben, können Sie diesen Hinweis ignorieren.";
- private final String checkboxText = "Ja, ich aktzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen.";
-
private final String infoTitle = "bwLehrpool Suite";
protected Button windowsDLButton;
protected Button linuxDLButton;
- protected Button readCheck;
- protected Button continueButton;
+ protected Button readCheck;
+ protected Button continueButton;
- public VMWareInfoComposite(final Shell mainShell) {
+ public VirtualizerNoticeWindowLayout(final Shell mainShell) {
super(mainShell, SWT.NONE);
// set the title of the bar.
@@ -41,8 +37,8 @@ public class VMWareInfoComposite extends Composite {
Label titleLabel = new Label(this, SWT.NONE);
titleLabel.setText(infoTitle);
FontData fontData = titleLabel.getFont().getFontData()[0];
- Font font = new Font(GuiManager.getDisplay(), new FontData(fontData.getName(), fontData
- .getHeight(), SWT.BOLD));
+ Font font = new Font(GuiManager.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(),
+ SWT.BOLD));
titleLabel.setFont(font);
// TODO dispose of font?
@@ -52,30 +48,26 @@ public class VMWareInfoComposite extends Composite {
GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
infoLabel.setLayoutData(gridData);
-
// composite for the windows vmware-download button
Composite windowsComposite = new Composite(this, SWT.NONE);
windowsComposite.setLayout(new GridLayout());
gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
windowsComposite.setLayoutData(gridData);
- new Label(windowsComposite, SWT.NONE).setText("Windows:");
+ new Label(windowsComposite, SWT.NONE).setText("Windows:");
windowsDLButton = new Button(windowsComposite, SWT.PUSH);
windowsDLButton.setText("VMWare Player Herunterladen");
-
// composite for the linux vmware-download button
Composite linuxComposite = new Composite(this, SWT.NONE);
linuxComposite.setLayout(new GridLayout());
gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
linuxComposite.setLayoutData(gridData);
- new Label(windowsComposite, SWT.NONE).setText("Linux:");
+ new Label(windowsComposite, SWT.NONE).setText("Linux:");
linuxDLButton = new Button(windowsComposite, SWT.PUSH);
linuxDLButton.setText("VMWare Player Herunterladen");
-
-
readCheck = new Button(this, SWT.CHECK);
readCheck.setText("Diese Benachrichtigung nicht mehr anzeigen.");
gridData = new GridData(GridData.BEGINNING, GridData.END, false, false);
diff --git a/dozentenmodul/src/main/java/wizards/ImageWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java
index 1723a2d2..1cac417e 100644
--- a/dozentenmodul/src/main/java/wizards/ImageWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java
@@ -1,6 +1,8 @@
-package wizards;
+package org.openslx.dozmod.gui.wizard;
import org.eclipse.jface.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.page.ImageMetaDataPage;
+import org.openslx.dozmod.gui.wizard.page.ImageUploadPage;
public class ImageWizard extends Wizard{
@@ -27,7 +29,6 @@ public class ImageWizard extends Wizard{
return "Neues Image erzeugen";
}
-
@Override
public void addPages() {
imageUploadPage = new ImageUploadPage(editExistingImage);
diff --git a/dozentenmodul/src/main/java/wizards/ImageMetaDataPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
index 4f267dda..3c27407d 100644
--- a/dozentenmodul/src/main/java/wizards/ImageMetaDataPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
@@ -1,10 +1,8 @@
-package wizards;
+package org.openslx.dozmod.gui.wizard.layout;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -16,14 +14,13 @@ import org.eclipse.swt.widgets.Text;
-public class ImageMetaDataPage extends WizardPage {
+public abstract class ImageMetaDataPageLayout extends WizardPage {
protected Composite container;
protected Combo osCombo;
protected Text descriptionText;
- protected Button licencedSoftwareCheck;
- protected Button licenceServerButton;
+ protected Button licencedSoftwareCheck;
// permissions checks
protected Button readPermissionsCheck;
@@ -36,9 +33,8 @@ public class ImageMetaDataPage extends WizardPage {
/**
* wizard page for entering image data at creating or editing an image
*/
- public ImageMetaDataPage() {
- super("Eingabe Ihrer Daten");
- setTitle("Eingabe Ihrer Daten");
+ public ImageMetaDataPageLayout() {
+ super("Eingabe Ihrer Daten", "Eingabe Ihrer Daten", null);
setDescription("Geben Sie bitte einen aussagekräftigen Namen für das neue Image ein.");
}
@@ -61,29 +57,22 @@ public class ImageMetaDataPage extends WizardPage {
Label descriptionCation = new Label(container, SWT.NONE);
descriptionCation.setText("Beschreibung:");
- descriptionText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
+ descriptionText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 80;
descriptionText.setLayoutData(gd);
Label licencedSoftwareCaption = new Label(container, SWT.NONE);
- licencedSoftwareCaption.setText("Image enthält lizensierte Software:");
+ licencedSoftwareCaption.setText("Image enthält lizenzpflichtige Software");
licencedSoftwareCheck = new Button(container, SWT.CHECK);
-
- Label licenceServerCaption = new Label(container, SWT.NONE);
- licenceServerCaption.setText("Lizenzserver:");
- licenceServerButton = new Button(container, SWT.PUSH);
- licenceServerButton.setText("Server-Adresse");
-
-
Group permissionsGroup = new Group(container, SWT.BORDER);
gd = new GridData();
gd.horizontalSpan = 2;
permissionsGroup.setLayoutData(gd);
- permissionsGroup.setText("Standart Berechtigungen");
+ permissionsGroup.setText("Standardberechtigungen");
permissionsGroup.setLayout(new GridLayout(4, true));
readPermissionsCheck = new Button(permissionsGroup, SWT.CHECK);
@@ -94,11 +83,6 @@ public class ImageMetaDataPage extends WizardPage {
linkPermissionsCheck.setText("Verlinken");
adminPermissionsCheck = new Button(permissionsGroup, SWT.CHECK);
adminPermissionsCheck.setText("Admin");
-
-
- // required to avoid an error in the system
- setControl(container);
- setPageComplete(true);
}
diff --git a/dozentenmodul/src/main/java/wizards/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
index b4f36589..4282f9dd 100644
--- a/dozentenmodul/src/main/java/wizards/ImageUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
@@ -1,4 +1,4 @@
-package wizards;
+package org.openslx.dozmod.gui.wizard.layout;
import org.eclipse.jface.wizard.WizardPage;
@@ -14,7 +14,7 @@ import org.eclipse.swt.widgets.Text;
-public class ImageUploadPage extends WizardPage {
+public abstract class ImageUploadPageLayout extends WizardPage {
protected Text imageName;
protected Composite container;
@@ -27,7 +27,7 @@ public class ImageUploadPage extends WizardPage {
* Page for uploading an imagefile
* @param editExistingImage wether to edit existing image file or create new one
*/
- public ImageUploadPage(boolean editExistingImage) {
+ public ImageUploadPageLayout(boolean editExistingImage) {
super("Eingabe Ihrer Daten");
setTitle("Eingabe Ihrer Daten");
setDescription("Geben Sie bitte einen aussagekräftigen Namen für das neue Image ein.");
@@ -74,13 +74,13 @@ public class ImageUploadPage extends WizardPage {
imageFileBrowseButton.setText("Browse");
- // required to avoid an error in the system
+ // required to avoid an error in the system <-- TODO: WTF?
setControl(container);
setPageComplete(editExistingImage);
}
- public String getText1() {
+ public String getText1() { // TODO: ????????????
return imageName.getText();
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java
new file mode 100644
index 00000000..969a6c52
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java
@@ -0,0 +1,7 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import org.openslx.dozmod.gui.wizard.layout.ImageMetaDataPageLayout;
+
+public class ImageMetaDataPage extends ImageMetaDataPageLayout {
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
new file mode 100644
index 00000000..617e7efc
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
@@ -0,0 +1,11 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import org.openslx.dozmod.gui.wizard.layout.ImageUploadPageLayout;
+
+public class ImageUploadPage extends ImageUploadPageLayout {
+
+ public ImageUploadPage(boolean editExistingImage) {
+ super(editExistingImage);
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ACache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ACache.java
index 68e8433d..4b859f66 100644
--- a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ACache.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ACache.java
@@ -1,4 +1,4 @@
-package org.openslx.bwlp.dozmod.thrift;
+package org.openslx.dozmod.thrift;
import java.util.concurrent.atomic.AtomicReference;
diff --git a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ImageCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageCache.java
index 2628807a..a2fac063 100644
--- a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/ImageCache.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageCache.java
@@ -1,12 +1,12 @@
-package org.openslx.bwlp.dozmod.thrift;
+package org.openslx.dozmod.thrift;
import java.util.List;
import org.apache.thrift.TException;
-import org.openslx.bwlp.dozmod.thrift.ACache.CacheMode;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
import org.openslx.bwlp.thrift.iface.TInternalServerError;
+import org.openslx.dozmod.thrift.ACache.CacheMode;
import org.openslx.thrifthelper.ThriftManager;
public class ImageCache {
diff --git a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/MetaDataCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/MetaDataCache.java
index 726dfd3d..d7dbd972 100644
--- a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/MetaDataCache.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/MetaDataCache.java
@@ -1,4 +1,4 @@
-package org.openslx.bwlp.dozmod.thrift;
+package org.openslx.dozmod.thrift;
import java.util.List;
diff --git a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/OrganizationCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/OrganizationCache.java
index 30a0cb3e..dde31d89 100644
--- a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/OrganizationCache.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/OrganizationCache.java
@@ -1,4 +1,4 @@
-package org.openslx.bwlp.dozmod.thrift;
+package org.openslx.dozmod.thrift;
import java.util.List;
diff --git a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/Session.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
index 0cdce3fd..33612746 100644
--- a/dozentenmodul/src/main/java/org/openslx/bwlp/dozmod/thrift/Session.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
@@ -1,8 +1,7 @@
-package org.openslx.bwlp.dozmod.thrift;
+package org.openslx.dozmod.thrift;
import org.openslx.bwlp.thrift.iface.ClientSessionData;
-
-import util.ServiceProviderResponse;
+import org.openslx.dozmod.authentication.ServiceProviderResponse;
public class Session {
diff --git a/dozentenmodul/src/main/java/util/CheckIntegrity.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/CheckIntegrity.java
index faded054..845c1734 100644
--- a/dozentenmodul/src/main/java/util/CheckIntegrity.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/CheckIntegrity.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.util;
public class CheckIntegrity {
diff --git a/dozentenmodul/src/main/java/util/FormatHelper.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/FormatHelper.java
index ad1f02f9..d69b7746 100644
--- a/dozentenmodul/src/main/java/util/FormatHelper.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/FormatHelper.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/dozentenmodul/src/main/java/util/News.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/News.java
index 5f3ea776..acedba09 100644
--- a/dozentenmodul/src/main/java/util/News.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/News.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.util;
import java.io.IOException;
import java.io.InputStream;
diff --git a/dozentenmodul/src/main/java/util/OpenLinks.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/OpenLinks.java
index 2bde54bf..224ad865 100644
--- a/dozentenmodul/src/main/java/util/OpenLinks.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/OpenLinks.java
@@ -1,4 +1,4 @@
-package util;
+package org.openslx.dozmod.util;
import java.awt.Desktop;
import java.net.URI;
@@ -27,7 +27,7 @@ public class OpenLinks {
put("otrs", "http://bwlehrpool.hs-offenburg.de");
put("vmware", "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0");
put("intro", "http://www.hs-offenburg.de/fileadmin/Einrichtungen/hrz/Projekte/bwLehrpool/3_bwLehrpool_-_Image_einbinden_und_starten.pdf");
-
+ // TODO use enum not map
}});
/**
diff --git a/dozentenmodul/src/main/java/config/ConfigProxy.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
index a97368d6..7ece2088 100644
--- a/dozentenmodul/src/main/java/config/ConfigProxy.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
@@ -1,4 +1,4 @@
-package config;
+package org.openslx.dozmod.util;
import java.io.IOException;
import java.net.ProxySelector;
@@ -20,12 +20,12 @@ import com.btr.proxy.util.Logger.LogLevel;
* @author Jonathan Bauer
*/
-public class ConfigProxy {
+public class ProxyConfigurator {
/**
* Logger for this class
*/
- private final static Logger LOGGER = Logger.getLogger(ConfigProxy.class);
+ private final static Logger LOGGER = Logger.getLogger(ProxyConfigurator.class);
/**
* Initialization method.
diff --git a/dozentenmodul/src/main/java/util/ResourceLoader.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java
index 8ad23601..89b7e6ba 100644
--- a/dozentenmodul/src/main/java/util/ResourceLoader.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java
@@ -1,6 +1,4 @@
-package util;
-
-import gui.GuiManager;
+package org.openslx.dozmod.util;
import java.awt.Graphics2D;
import java.awt.SystemColor;
@@ -21,6 +19,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Text;
+import org.openslx.dozmod.gui.helper.GuiManager;
/**
* Helper class for loading resources. This should be error safe loaders with a