summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-04 15:50:13 +0200
committerSimon Rettberg2015-09-04 15:50:13 +0200
commit41c04b3b5192a274b4572d7efc2d533b9fda8f98 (patch)
tree96a27a517ef4f464b24dba24fad99d2bfd29a9e2 /dozentenmodulserver/src/main/java
parent[client] Don't add logged in user into user list for permissions in the wizard. (diff)
downloadtutor-module-41c04b3b5192a274b4572d7efc2d533b9fda8f98.tar.gz
tutor-module-41c04b3b5192a274b4572d7efc2d533b9fda8f98.tar.xz
tutor-module-41c04b3b5192a274b4572d7efc2d533b9fda8f98.zip
[*] OS now has mem and cpu info
Diffstat (limited to 'dozentenmodulserver/src/main/java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOsVirt.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOsVirt.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOsVirt.java
index f49c9065..5251eec0 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOsVirt.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOsVirt.java
@@ -40,15 +40,15 @@ public class DbOsVirt {
public static List<OperatingSystem> getOsList() throws SQLException {
try (MysqlConnection connection = Database.getConnection()) {
// Query OSs
- MysqlStatement stmt = connection.prepareStatement("SELECT osid, displayname, architecture"
- + " FROM operatingsystem");
+ MysqlStatement stmt = connection.prepareStatement("SELECT"
+ + " osid, displayname, architecture, maxmem, maxcpu" + " FROM operatingsystem");
ResultSet rs = stmt.executeQuery();
List<OperatingSystem> list = new ArrayList<>();
Map<Integer, Map<String, String>> osVirtMappings = getOsVirtMappings(connection);
while (rs.next()) {
int osId = rs.getInt("osid");
list.add(new OperatingSystem(osId, rs.getString("displayname"), osVirtMappings.get(osId),
- rs.getString("architecture")));
+ rs.getString("architecture"), rs.getInt("maxmem"), rs.getInt("maxcpu")));
}
return list;
} catch (SQLException e) {
@@ -56,8 +56,9 @@ public class DbOsVirt {
throw e;
}
}
-
- private static Map<Integer, Map<String, String>> getOsVirtMappings(MysqlConnection connection) throws SQLException {
+
+ private static Map<Integer, Map<String, String>> getOsVirtMappings(MysqlConnection connection)
+ throws SQLException {
MysqlStatement stmt = connection.prepareStatement("SELECT osid, virtid, virtoskeyword FROM os_x_virt");
ResultSet rs = stmt.executeQuery();
Map<Integer, Map<String, String>> map = new HashMap<>();
@@ -76,8 +77,7 @@ public class DbOsVirt {
public static void storeVirtualizerList(List<Virtualizer> list) throws SQLException {
try (MysqlConnection connection = Database.getConnection()) {
MysqlStatement stmt = connection.prepareStatement("INSERT INTO virtualizer"
- + " (virtid, virtname) VALUES"
- + " (:virtid, :virtname)"
+ + " (virtid, virtname) VALUES" + " (:virtid, :virtname)"
+ " ON DUPLICATE KEY UPDATE virtname = VALUES(virtname)");
for (Virtualizer virt : list) {
stmt.setString("virtid", virt.virtId);
@@ -93,8 +93,7 @@ public class DbOsVirt {
public static List<Virtualizer> getVirtualizerList() throws SQLException {
try (MysqlConnection connection = Database.getConnection()) {
- MysqlStatement stmt = connection.prepareStatement("SELECT virtid, virtname"
- + " FROM virtualizer");
+ MysqlStatement stmt = connection.prepareStatement("SELECT virtid, virtname" + " FROM virtualizer");
ResultSet rs = stmt.executeQuery();
List<Virtualizer> list = new ArrayList<>();
while (rs.next()) {