summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/util
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-15 17:06:20 +0200
committerJonathan Bauer2015-09-15 17:06:20 +0200
commit28f84e5923208b3ff32dcd332a1212caf132cf89 (patch)
treee71ac6d8ca11b1e890493da7bfbbf09cc9401ee2 /dozentenmodul/src/main/java/org/openslx/dozmod/util
parent[client] reworked german text (diff)
parent[client] Shift key for forcing satellite selection now works. (diff)
downloadtutor-module-28f84e5923208b3ff32dcd332a1212caf132cf89.tar.gz
tutor-module-28f84e5923208b3ff32dcd332a1212caf132cf89.tar.xz
tutor-module-28f84e5923208b3ff32dcd332a1212caf132cf89.zip
Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/util')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
index 8818d558..a3fcee4b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
@@ -1,13 +1,19 @@
package org.openslx.dozmod.util;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.log4j.Logger;
+import org.openslx.sat.thrift.version.Version;
import org.openslx.util.Json;
// ClientVersion is a bad name, TODO find better suited one :)
@@ -29,7 +35,7 @@ public class ClientVersion {
localRevision = "???";
}
if (remoteRevision == null) {
- loadRemoteVersion("http://132.230.4.25/dozmod.version");
+ loadRemoteVersion("https://bwlp-masterserver.ruf.uni-freiburg.de/dozmod/" + Version.VERSION + "/version.json");
}
if (remoteRevision == null) {
remoteRevision = "???";
@@ -190,4 +196,31 @@ public class ClientVersion {
String revision;
String changelog;
}
+
+ public static void createJson(String name) throws IOException {
+ loadLocalVersion();
+ if (localRevisionTime == 0)
+ throw new RuntimeException("Missing manifest/data in jar: No revision time found");
+ if (localRevision == null || localRevision.isEmpty())
+ throw new RuntimeException("Missing manifest/data in jar: No commit hash found");
+ System.out.println("Please enter change log. To finish, put a '.' on a single line");
+ StringBuilder sb = new StringBuilder();
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ for (String line; (line = br.readLine()) != null;) {
+ if (line.equals("."))
+ break;
+ sb.append(line);
+ sb.append('\n');
+ }
+ VersionQuery vq = new VersionQuery();
+ vq.timestamp = localRevisionTime;
+ vq.revision = localRevision;
+ vq.changelog = sb.toString();
+ String data = Json.serialize(vq);
+ FileUtils.writeStringToFile(new File(name), data, StandardCharsets.UTF_8);
+ System.out.println();
+ System.out.println("Created json file at " + name);
+ System.out.println("This build is using Thrift RPC interface version >> " + Version.VERSION + " <<");
+ System.out.println();
+ }
}