summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-06-16 18:52:28 +0200
committerSimon Rettberg2015-06-16 18:52:28 +0200
commit9a2508402914d06cd191152d09ae706f4b239dbb (patch)
tree1b48092c09d6e2ed670bd6472011df97fdc65e54
parent[server] Add script field to lecture table; implement getImageDetails method ... (diff)
downloadtutor-module-9a2508402914d06cd191152d09ae706f4b239dbb.tar.gz
tutor-module-9a2508402914d06cd191152d09ae706f4b239dbb.tar.xz
tutor-module-9a2508402914d06cd191152d09ae706f4b239dbb.zip
[server] Implement getOperatingSystems and getVirtualizers
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java8
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java1
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java27
3 files changed, 32 insertions, 4 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 7307fbae..2fe18160 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
@@ -11,6 +11,8 @@ import org.openslx.bwlp.sat.database.mappers.DbImage;
import org.openslx.bwlp.sat.fileserv.ActiveUpload;
import org.openslx.bwlp.sat.fileserv.FileServer;
import org.openslx.bwlp.sat.thrift.cache.OperatingSystemList;
+import org.openslx.bwlp.sat.thrift.cache.OrganizationList;
+import org.openslx.bwlp.sat.thrift.cache.VirtualizerList;
import org.openslx.bwlp.thrift.iface.ImageBaseWrite;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
@@ -97,14 +99,12 @@ public class ServerHandler implements SatelliteServer.Iface {
@Override
public List<Virtualizer> getVirtualizers() throws TException {
- // TODO Auto-generated method stub
- return null;
+ return VirtualizerList.get();
}
@Override
public List<Organization> getAllOrganizations() throws TException {
- // TODO Auto-generated method stub
- return null;
+ return OrganizationList.get();
}
@Override
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java
index 58b5d84e..ea81a452 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/OperatingSystemList.java
@@ -21,6 +21,7 @@ public class OperatingSystemList extends CacheBase<List<OperatingSystem>> {
@Override
protected List<OperatingSystem> getCallback() throws TException {
return ThriftManager.getMasterClient().getOperatingSystems();
+ // TODO: Store in DB
}
}
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java
new file mode 100644
index 00000000..87b85186
--- /dev/null
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/VirtualizerList.java
@@ -0,0 +1,27 @@
+package org.openslx.bwlp.sat.thrift.cache;
+
+import java.util.List;
+
+import org.apache.thrift.TException;
+import org.openslx.bwlp.thrift.iface.Virtualizer;
+import org.openslx.thrifthelper.ThriftManager;
+
+/**
+ * Holds the list of all known virtualizers. The list is synchronized with
+ * the master server.
+ */
+public class VirtualizerList extends CacheBase<List<Virtualizer>> {
+
+ private static final VirtualizerList instance = new VirtualizerList();
+
+ public static List<Virtualizer> get() {
+ return instance.getInternal();
+ }
+
+ @Override
+ protected List<Virtualizer> getCallback() throws TException {
+ return ThriftManager.getMasterClient().getVirtualizers();
+ // TODO: Store in DB
+ }
+
+}