summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
diff options
context:
space:
mode:
authorJonathan Bauer2015-08-21 14:36:41 +0200
committerJonathan Bauer2015-08-21 14:36:41 +0200
commitd60450ab1d9338f335663e41e5818395f962d56f (patch)
tree76da0fb5625111df27581e0d89bcc80a47492275 /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
parent[client] ThriftActions for Image Metadata (details + permissions) and use the... (diff)
downloadtutor-module-d60450ab1d9338f335663e41e5818395f962d56f.tar.gz
tutor-module-d60450ab1d9338f335663e41e5818395f962d56f.tar.xz
tutor-module-d60450ab1d9338f335663e41e5818395f962d56f.zip
[client] ThriftActions & calls in ImageWizard.performFinish
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java41
1 files changed, 35 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
index 9b9179cb..2f47cb81 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -13,6 +13,7 @@ import javax.swing.JFileChooser;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
+import org.openslx.bwlp.thrift.iface.ImageBaseWrite;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.ImageVersionWrite;
@@ -182,18 +183,46 @@ public class ThriftActions {
String uuid = null;
try {
uuid = ThriftManager.getSatClient().createImage(Session.getSatelliteToken(), name);
- } catch (TAuthorizationException e) {
- Gui.showMessageBox(frame, "Sie sind nicht Berechtigt ein Image zu estellen.",
- MessageType.ERROR, LOGGER, e);
- } catch (TImageDataException e) {
- Gui.showMessageBox(frame, "Ungültige Angaben (" + e.getNumber() + ")\n" + e.getMessage(),
- MessageType.ERROR, LOGGER, e);
+ } catch (TException e) {
+ ThriftError.showMessage(frame, LOGGER, e, "Erstellen des Images fehlgeschlagen");
} catch (Exception e) {
Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR,
LOGGER, e);
}
return uuid;
}
+ /**
+ * GUI-BLOCKING
+ * Pushes a new image base to the server with the given imageBaseId and the meta information in meta
+ *
+ * @param frame to show user feedback on
+ * @param imageBaseId image's id we are writing meta information of
+ * @param meta actual meta information as ImageBaseWrite
+ */
+ public static void updateImageBase(final Frame frame, final String imageBaseId, final ImageBaseWrite meta) {
+ try {
+ ThriftManager.getSatClient().updateImageBase(Session.getSatelliteToken(),
+ imageBaseId, meta);
+ } catch (TException e) {
+ ThriftError.showMessage(frame, LOGGER, e, "Konnte Metadaten des Images nicht hochladen");
+ }
+ }
+ /**
+ * GUI-BLOCKING
+ * Pushes the given permission map as custom permission for the given imageBaseId
+ *
+ * @param frame to show user feedback on
+ * @param imageBaseId image's id we are writing permissions of
+ * @param permissions actual permissions map to write
+ */
+ public static void writeImagePermissions(final Frame frame, final String imageBaseId, final Map<String, ImagePermissions> permissions) {
+ try {
+ ThriftManager.getSatClient().writeImagePermissions(Session.getSatelliteToken(),
+ imageBaseId, permissions);
+ } catch (TException e) {
+ ThriftError.showMessage(frame, LOGGER, e, "Konnte Berechtigungen nicht hochladen");
+ }
+ }
/* *******************************************************************************
*