diff options
author | Jonathan Bauer | 2016-08-31 16:54:59 +0200 |
---|---|---|
committer | Jonathan Bauer | 2016-08-31 16:54:59 +0200 |
commit | 26cd5699373dbe35ee24700189e8a3e580ae6243 (patch) | |
tree | 0389541c704fbfe05aeb514365e4643f84bbfa20 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | |
parent | [client] Reset filter when hiding lecture list if filtered by linked image (diff) | |
download | tutor-module-26cd5699373dbe35ee24700189e8a3e580ae6243.tar.gz tutor-module-26cd5699373dbe35ee24700189e8a3e580ae6243.tar.xz tutor-module-26cd5699373dbe35ee24700189e8a3e580ae6243.zip |
[client] vm-config editor finished, accessible from the popup menu of image's versions
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java index a76382ba..d6f6ce74 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java @@ -724,4 +724,38 @@ public class ServerHandler implements SatelliteServer.Iface { } } + @Override + public ByteBuffer getImageVersionVirtConfig(String userToken, + String imageVersionId) throws TAuthorizationException, + TNotFoundException, TInvocationException, TException { + UserInfo user = SessionManager.getOrFail(userToken); + User.canSeeImageDetailsOrFail(user); + byte[] machineDescription = null; + try { + machineDescription = DbImage.getVirtualizerConfig(imageVersionId); + } catch (SQLException e) { + throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, + "Database failure when retrieving the virtualizer config for '" + imageVersionId + "'."); + } + if (machineDescription == null) + return null; + return ByteBuffer.wrap(machineDescription); + } + + @Override + public ByteBuffer setImageVersionVirtConfig(String userToken, String imageVersionId, + ByteBuffer machineDescription) throws TAuthorizationException, + TNotFoundException, TInvocationException, TException { + SessionManager.getOrFail(userToken); + UserInfo user = SessionManager.getOrFail(userToken); + User.canEditImageVersionOrFail(user, imageVersionId); + byte[] mdBytes = ThriftUtil.unwrapByteBuffer(machineDescription); + try { + DbImage.setVirtualizerConfig(imageVersionId, mdBytes); + } catch (SQLException e) { + throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, + "Database failure when setting the virtualizer config for '" + imageVersionId + "'."); + } + return ByteBuffer.wrap(mdBytes); + } } |