summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-01 16:45:04 +0200
committerJonathan Bauer2015-09-01 16:45:04 +0200
commit0505d3e4126c5b9b5915243fd159550b506ae592 (patch)
tree532cb21c50bb20739c559d3bd7f0e9f8b753dcf1 /dozentenmodul
parent[client] Disclaimer minor typos & no close on clicking the "close" symbol (diff)
parent[client] Ignore certain thrift methods in our error handler (diff)
downloadtutor-module-0505d3e4126c5b9b5915243fd159550b506ae592.tar.gz
tutor-module-0505d3e4126c5b9b5915243fd159550b506ae592.tar.xz
tutor-module-0505d3e4126c5b9b5915243fd159550b506ae592.zip
Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java245
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java11
3 files changed, 129 insertions, 130 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
index df0b160e..11c3c3da 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
@@ -31,6 +31,9 @@ public class GuiErrorCallback implements ErrorCallback {
// if it's the first fail, retry immediately
if (failCount == 1)
return true;
+ // Some methods are non-critical, so don't show a pop-up
+ if (ThriftError.failSilently(method))
+ return false;
// Otherwise, ask user if we should retry
return Gui.syncExec(new GuiCallable<Boolean>() {
@Override
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 f15e6e6c..dc1ce2df 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -64,12 +64,10 @@ public class ThriftActions {
* ****
*/
/**
- * @param frame
- * to show user feedback on
- * @param data
- * AuthenticationData as received from a successfull login, or
+ * @param frame to show user feedback on
+ * @param data AuthenticationData as received from a successful login, or
* null if trying to resume a saved sessions
- * @return true if initiliazing the session worked, false otherwise
+ * @return true if initializing the session worked, false otherwise
*/
public static boolean initSession(final Frame frame, AuthenticationData data) {
Client client = null;
@@ -114,8 +112,8 @@ public class ThriftActions {
if (data != null) {
Gui.showMessageBox(frame,
"Das von Ihnen verwendete Dozentenmodul ist nicht mit dem Satelliten-Server kompatibel.\n"
- + "Ihre Version: " + Version.VERSION + "\n" + "Satelliten-Version: " + remoteVersion,
- MessageType.ERROR, LOGGER, null);
+ + "Ihre Version: " + Version.VERSION + "\n" + "Satelliten-Version: "
+ + remoteVersion, MessageType.ERROR, LOGGER, null);
}
return false;
}
@@ -125,8 +123,9 @@ public class ThriftActions {
} catch (TAuthorizationException e) {
if (data != null) {
Gui.showMessageBox(frame,
- "Authentifizierung erfolgreich, der Satellit verweigert jedoch die Verbindung.\n\n" + "Grund: "
- + e.number.toString() + " (" + e.message + ")", MessageType.ERROR, null, null);
+ "Authentifizierung erfolgreich, der Satellit verweigert jedoch die Verbindung.\n\n"
+ + "Grund: " + e.number.toString() + " (" + e.message + ")",
+ MessageType.ERROR, null, null);
}
return false;
} catch (TInvocationException e) {
@@ -139,7 +138,8 @@ public class ThriftActions {
return false;
} catch (Exception e) {
if (data != null) {
- Gui.showMessageBox(frame,
+ Gui.showMessageBox(
+ frame,
"Authentifizierung erfolgreich, aber der Satellit akzeptiert das Sitzungstoken nicht.",
MessageType.ERROR, LOGGER, e);
}
@@ -148,7 +148,8 @@ public class ThriftActions {
if (whoami != null) {
Session.initialize(whoami, address, satToken, masterToken);
- ThriftManager.setSatelliteAddress(GraphicalCertHandler.getSslContext(Session.getSatelliteAddress()),
+ ThriftManager.setSatelliteAddress(
+ GraphicalCertHandler.getSslContext(Session.getSatelliteAddress()),
Session.getSatelliteAddress(), App.THRIFT_SSL_PORT, App.THRIFT_TIMEOUT_MS);
return true;
}
@@ -168,8 +169,7 @@ public class ThriftActions {
* GUI-BLOCKING Creates the image with the given name. Returns the uuid
* returned by the server
*
- * @param frame
- * calling this action
+ * @param frame calling this action
* @return uuid as String, or null if the creation failed
*/
public static String createImage(final Frame frame, final String name) {
@@ -179,7 +179,8 @@ public class ThriftActions {
} 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);
+ Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR, LOGGER,
+ e);
}
return uuid;
}
@@ -188,14 +189,12 @@ public class ThriftActions {
* 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
+ * @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 boolean updateImageBase(final Frame frame, final String imageBaseId, final ImageBaseWrite meta) {
+ public static boolean updateImageBase(final Frame frame, final String imageBaseId,
+ final ImageBaseWrite meta) {
try {
ThriftManager.getSatClient().updateImageBase(Session.getSatelliteToken(), imageBaseId, meta);
} catch (TException e) {
@@ -209,17 +208,15 @@ public class ThriftActions {
* 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
+ * @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);
+ ThriftManager.getSatClient().writeImagePermissions(Session.getSatelliteToken(), imageBaseId,
+ permissions);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Konnte Berechtigungen nicht übertragen");
}
@@ -241,12 +238,9 @@ public class ThriftActions {
* TransferInformation received by the server or null if the request failed.
* Will give user feedback about failures.
*
- * @param frame
- * caller of this method
- * @param imageBaseId
- * uuid of the image to upload a version of
- * @param fileSize
- * size in bytes(?) of the uploaded file
+ * @param frame caller of this method
+ * @param imageBaseId uuid of the image to upload a version of
+ * @param fileSize size in bytes(?) of the uploaded file
* @param blockHashes
* @param machineDescription
* @param callback
@@ -256,7 +250,8 @@ public class ThriftActions {
public static TransferInformation requestVersionUpload(final Frame frame, final String imageBaseId,
final long fileSize, final List<ByteBuffer> blockHashes, final ByteBuffer machineDescription) {
try {
- if (ThriftManager.getSatClient().getStatus().getAvailableStorageBytes() < fileSize + SIZE_CHECK_EXTRA_UL) {
+ if (ThriftManager.getSatClient().getStatus().getAvailableStorageBytes() < fileSize
+ + SIZE_CHECK_EXTRA_UL) {
Gui.showMessageBox(
frame,
"Nicht genügend Speicherplatz Satelliten. Löschen Sie nicht verwendete Imageversionen oder kontaktieren sie den Administrator.",
@@ -269,8 +264,8 @@ public class ThriftActions {
}
TransferInformation ti = null;
try {
- ti = ThriftManager.getSatClient().requestImageVersionUpload(Session.getSatelliteToken(), imageBaseId,
- fileSize, null, // TODO remove deprecated parameter
+ ti = ThriftManager.getSatClient().requestImageVersionUpload(Session.getSatelliteToken(),
+ imageBaseId, fileSize, null, // TODO remove deprecated parameter
machineDescription);
LOGGER.info("Version upload granted, versionId: '" + ti.toString());
} catch (TAuthorizationException e) {
@@ -285,19 +280,15 @@ public class ThriftActions {
* GUI-BLOCKING Starts uploading the given diskFile using the
* transferInformation and hashGen
*
- * @param frame
- * caller of this method
- * @param transferInformation
- * transfer information to use for the upload
- * @param hashGen
- * hash generator for this file
- * @param diskFile
- * the file to upload
+ * @param frame caller of this method
+ * @param transferInformation transfer information to use for the upload
+ * @param hashGen hash generator for this file
+ * @param diskFile the file to upload
* @return UploadTask if the uploading initialized, or null if uploading
* failed
*/
- public static InitUploadStatus initUpload(final Frame frame, final TransferInformation transferInformation,
- final File diskFile) {
+ public static InitUploadStatus initUpload(final Frame frame,
+ final TransferInformation transferInformation, final File diskFile) {
UploadTask uploadTask = null;
// do actually start the upload now
LOGGER.debug("Starting upload for: " + diskFile.toPath());
@@ -305,7 +296,8 @@ public class ThriftActions {
uploadTask = new UploadTask(Session.getSatelliteAddress(), transferInformation.getPlainPort(),
transferInformation.getToken(), diskFile);
} catch (FileNotFoundException e) {
- Gui.asyncMessageBox("Kann VM nicht hochladen: Datei nicht gefunden\n\n" + diskFile.getAbsolutePath(),
+ Gui.asyncMessageBox(
+ "Kann VM nicht hochladen: Datei nicht gefunden\n\n" + diskFile.getAbsolutePath(),
MessageType.ERROR, LOGGER, e);
return null;
}
@@ -326,10 +318,12 @@ public class ThriftActions {
do { // Even more ugly - block the GUI thread so we know whether the
// upload started, and only then switch to the next page
Util.sleep(5);
- } while (uploadTask.getFailCount() == 0 && uploadTask.getTransferCount() == 0 && !uploadTask.isCanceled());
+ } while (uploadTask.getFailCount() == 0 && uploadTask.getTransferCount() == 0
+ && !uploadTask.isCanceled());
if (uploadTask.getTransferCount() == 0) {
- Gui.asyncMessageBox("Aufbau der Verbindung zum Hochladen fehlgeschlagen", MessageType.ERROR, LOGGER, null);
+ Gui.asyncMessageBox("Aufbau der Verbindung zum Hochladen fehlgeschlagen", MessageType.ERROR,
+ LOGGER, null);
hashGen.cancel();
uploadTask.cancel();
uploadTask = null;
@@ -347,7 +341,8 @@ public class ThriftActions {
public static boolean updateImageVersion(final Frame frame, final String versionId,
final ImageVersionWrite versionInfo) {
try {
- ThriftManager.getSatClient().updateImageVersion(Session.getSatelliteToken(), versionId, versionInfo);
+ ThriftManager.getSatClient().updateImageVersion(Session.getSatelliteToken(), versionId,
+ versionInfo);
} catch (TException e) {
Gui.showMessageBox(frame, "Konnte neue Version nicht erstellen!", MessageType.ERROR, LOGGER, e);
return false;
@@ -378,19 +373,13 @@ public class ThriftActions {
* NON-BLOCKING Initialises the download of the given imageVersionId saving
* it to the given imageName
*
- * @param frame
- * caller of this method
- * @param imageVersionId
- * image version id to download
- * @param imageName
- * destination file name
- * @param virtualizerId
- * id of the virtualizer
- * @param imageSize
- * size in bytes of the image to download
- * @param callback
- * callback function to return status of this operation to the
- * GUI
+ * @param frame caller of this method
+ * @param imageVersionId image version id to download
+ * @param imageName destination file name
+ * @param virtualizerId id of the virtualizer
+ * @param imageSize size in bytes of the image to download
+ * @param callback callback function to return status of this operation to
+ * the GUI
*/
public static void initDownload(final Frame frame, final String imageVersionId, final String imageName,
final String virtualizerId, final long imageSize, final DownloadCallback callback) {
@@ -411,7 +400,8 @@ public class ThriftActions {
if (diskFile.exists()) {
boolean ret = Gui.showMessageBox(frame, "Datei '" + diskFile.getAbsolutePath()
- + "' existiert bereits, wollen Sie sie überschreiben?", MessageType.QUESTION_YESNO, LOGGER, null);
+ + "' existiert bereits, wollen Sie sie überschreiben?", MessageType.QUESTION_YESNO,
+ LOGGER, null);
if (!ret) {
// user aborted
if (callback != null)
@@ -420,7 +410,8 @@ public class ThriftActions {
}
// delete it
if (!diskFile.delete() && diskFile.exists()) {
- Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR,
+ LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -430,8 +421,9 @@ public class ThriftActions {
// Check the free space on disk
if (destDir.getUsableSpace() < imageSize + SIZE_CHECK_EXTRA_DL) {
Gui.showMessageBox(frame, "Nicht genügend Speicherplatz im ausgewählten Verzeichnis verfügbar.\n"
- + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n" + "Habe: "
- + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR, LOGGER, null);
+ + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n"
+ + "Habe: " + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR,
+ LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -454,8 +446,8 @@ public class ThriftActions {
public void fire() {
TransferInformation transInf;
try {
- transInf = ThriftManager.getSatClient()
- .requestDownload(Session.getSatelliteToken(), imageVersionId);
+ transInf = ThriftManager.getSatClient().requestDownload(Session.getSatelliteToken(),
+ imageVersionId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Die Download-Anfrage ist gescheitert");
if (callback != null)
@@ -465,8 +457,8 @@ public class ThriftActions {
final DownloadTask dlTask;
try {
- dlTask = new DownloadTask(Session.getSatelliteAddress(), transInf.getPlainPort(), transInf
- .getToken(), tmpFile, imageSize, null);
+ dlTask = new DownloadTask(Session.getSatelliteAddress(), transInf.getPlainPort(),
+ transInf.getToken(), tmpFile, imageSize, null);
} catch (FileNotFoundException e) {
Gui.asyncMessageBox(
"Konnte Download nicht vorbereiten: Der gewählte Zielort ist nicht beschreibbar",
@@ -554,7 +546,8 @@ public class ThriftActions {
* @param imageBaseId
* @param callback
*/
- public static void getImageDetails(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
+ public static void getImageDetails(final Frame frame, final String imageBaseId,
+ final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
ImageDetailsRead details = null;
@@ -573,7 +566,8 @@ public class ThriftActions {
});
}
- public static void getImageFullDetails(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
+ public static void getImageFullDetails(final Frame frame, final String imageBaseId,
+ final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
ImageDetailsRead details = null;
Map<String, ImagePermissions> permissions = null;
@@ -596,7 +590,8 @@ public class ThriftActions {
}
// async
- public static void getImagePermissions(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
+ public static void getImagePermissions(final Frame frame, final String imageBaseId,
+ final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
Map<String, ImagePermissions> permissionMap = null;
@@ -616,10 +611,12 @@ public class ThriftActions {
}
// sync
- public static Map<String, ImagePermissions> getImagePermissions(final Frame frame, final String imageBaseId) {
+ public static Map<String, ImagePermissions> getImagePermissions(final Frame frame,
+ final String imageBaseId) {
Map<String, ImagePermissions> permissionMap = null;
try {
- permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(), imageBaseId);
+ permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(),
+ imageBaseId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten");
}
@@ -629,17 +626,15 @@ public class ThriftActions {
/**
* GUI-BLOCKING Sets the owner of the given lectureId to newOwner
*
- * @param frame
- * to display user feedback on
- * @param lectureId
- * lecture's id to set the new owner of
- * @param newOwner
- * as UserInfo
+ * @param frame to display user feedback on
+ * @param lectureId lecture's id to set the new owner of
+ * @param newOwner as UserInfo
* @return true if it worked, false otherwise
*/
public static boolean setImageOwner(final Frame frame, final String lectureId, final UserInfo newOwner) {
try {
- ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId());
+ ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId,
+ newOwner.getUserId());
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
return false;
@@ -664,13 +659,13 @@ public class ThriftActions {
/**
* Called once the status of a delete operation is determined
*
- * @param success
- * true if deleted successfully, false otherwise
+ * @param success true if deleted successfully, false otherwise
*/
void isDeleted(boolean success);
}
- public static void deleteImageBase(final Frame frame, final String imageBaseId, final DeleteCallback callback) {
+ public static void deleteImageBase(final Frame frame, final String imageBaseId,
+ final DeleteCallback callback) {
if (imageBaseId == null || imageBaseId.isEmpty())
return;
// first look if we have versions
@@ -680,8 +675,8 @@ public class ThriftActions {
List<ImageVersionDetails> versionToBeDeleted = null;
try {
details = ThriftManager.getSatClient().getImageDetails(Session.getSatelliteToken(), imageBaseId);
- List<LectureSummary> lectureList = ThriftManager.getSatClient().getLectureList(Session.getSatelliteToken(),
- 100);
+ List<LectureSummary> lectureList = ThriftManager.getSatClient().getLectureList(
+ Session.getSatelliteToken(), 100);
for (LectureSummary lecture : lectureList) {
if (lecture.getImageBaseId().equals(imageBaseId)) {
if (lecturesToBeDeleted == null)
@@ -742,17 +737,14 @@ public class ThriftActions {
* and imageVersionId. The success of the operation will be forwarded to the
* GUI through the DeleteCallback.
*
- * @param frame
- * next parent frame of the caller of this method
- * @param imageBaseId
- * uuid of the image that belongs to the version
- * @param imageVersionId
- * id of the image version to be deleted
- * @param callback
- * called to inform the GUI about the deletion status (see
+ * @param frame next parent frame of the caller of this method
+ * @param imageBaseId uuid of the image that belongs to the version
+ * @param imageVersionId id of the image version to be deleted
+ * @param callback called to inform the GUI about the deletion status (see
* DeleteCallback interface)
*/
- public static void deleteImageVersion(final Frame frame, final String imageVersionId, final DeleteCallback callback) {
+ public static void deleteImageVersion(final Frame frame, final String imageVersionId,
+ final DeleteCallback callback) {
// TODO async?
if (imageVersionId == null || imageVersionId.isEmpty())
return;
@@ -821,10 +813,8 @@ public class ThriftActions {
/**
* Creates a lecture with the given meta data
*
- * @param frame
- * to show user feedback on
- * @param meta
- * actual meta data as LectureWrite
+ * @param frame to show user feedback on
+ * @param meta actual meta data as LectureWrite
* @return the created lecture's id if it worked, null otherwise
*/
public static String createLecture(final Frame frame, final LectureWrite meta) {
@@ -844,17 +834,15 @@ public class ThriftActions {
* GUI-BLOCKING Writes custom lecture permissions (permissions param) for
* the given lectureId.
*
- * @param frame
- * to show user feedback on
- * @param lectureId
- * lecture's id to write custom permissions for
- * @param permissions
- * actual permission map to push
+ * @param frame to show user feedback on
+ * @param lectureId lecture's id to write custom permissions for
+ * @param permissions actual permission map to push
*/
public static boolean writeLecturePermissions(final Frame frame, final String lectureId,
final Map<String, LecturePermissions> permissions) {
try {
- ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId, permissions);
+ ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId,
+ permissions);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Failed to write lecture permissions");
return false;
@@ -934,15 +922,13 @@ public class ThriftActions {
* GUI-BLOCKING Updates the lecture with given lectureId to the given
* lecture
*
- * @param frame
- * to show user feedback on
- * @param lectureId
- * lecture's is to update
- * @param lecture
- * LectureWrite data to update the lecture with
+ * @param frame to show user feedback on
+ * @param lectureId lecture's is to update
+ * @param lecture LectureWrite data to update the lecture with
* @return
*/
- public static boolean updateLecture(final Frame frame, final String lectureId, final LectureWrite lectureWrite) {
+ public static boolean updateLecture(final Frame frame, final String lectureId,
+ final LectureWrite lectureWrite) {
try {
ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lectureId, lectureWrite);
} catch (TException e) {
@@ -959,11 +945,13 @@ public class ThriftActions {
* @param lectureId
* @param callback
*/
- public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame, final String lectureId) {
+ public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame,
+ final String lectureId) {
Map<String, LecturePermissions> permissions = null;
try {
- permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(), lectureId);
+ permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(),
+ lectureId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen");
}
@@ -974,17 +962,15 @@ public class ThriftActions {
/**
* GUI-BLOCKING Sets the owner of the given lectureId to newOwner
*
- * @param frame
- * to display user feedback on
- * @param lectureId
- * lecture's id to set the new owner of
- * @param newOwner
- * as UserInfo
+ * @param frame to display user feedback on
+ * @param lectureId lecture's id to set the new owner of
+ * @param newOwner as UserInfo
* @return true if it worked, false otherwise
*/
public static boolean setLectureOwner(final Frame frame, final String lectureId, final UserInfo newOwner) {
try {
- ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId());
+ ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId,
+ newOwner.getUserId());
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
return false;
@@ -1015,7 +1001,8 @@ public class ThriftActions {
* @param lectureId
* @param callback
*/
- public static void deleteLecture(final Frame frame, final String lectureId, final DeleteLectureCallback callback) {
+ public static void deleteLecture(final Frame frame, final String lectureId,
+ final DeleteLectureCallback callback) {
if (lectureId == null)
return;
if (!userConfirmed(frame, "Wollen Sie diese Veranstaltung wirklick löschen?"))
@@ -1053,10 +1040,8 @@ public class ThriftActions {
/**
* Helper to ask the user for confirmation. Returns his choice.
*
- * @param frame
- * frame to show this message box on
- * @param message
- * question message to display to the user
+ * @param frame frame to show this message box on
+ * @param message question message to display to the user
* @return true if the user confirmed (clicked yes), false otherwise
*/
private static boolean userConfirmed(final Frame frame, final String message) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
index 6982f8e5..33fd98b6 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
@@ -102,4 +102,15 @@ public class ThriftError {
}
}
+ private static final String[] ignoredMethods = { "ping", "getStatus", "updateBlockHashes",
+ "cancelUpload", "cancelDownload" };
+
+ public static boolean failSilently(String methodName) {
+ for (int i = 0; i < ignoredMethods.length; ++i) {
+ if (ignoredMethods[i].equals(methodName))
+ return true;
+ }
+ return false;
+ }
+
}