* right versioning and buildtime variables
* new INFO object to store buildtime and version
This commit is contained in:
parent
0f33a475a4
commit
73d6c86fe3
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<Languages>
|
||||
<language minSize="47" name="Java" />
|
||||
</Languages>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
16
build.gradle
16
build.gradle
@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'com.wasteinformationserver'
|
||||
version '1.0-SNAPSHOT'
|
||||
version '0.1-Beta'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
@ -32,4 +32,18 @@ task run (type: JavaExec){
|
||||
description = "Secure algorythm testing"
|
||||
main = 'com.wasteinformationserver.main'
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
task createProperties(dependsOn: processResources) {
|
||||
doLast {
|
||||
new File("$projectDir/src/resources/version.properties").withWriter { w ->
|
||||
Properties p = new Properties()
|
||||
p['version'] = project.version.toString()
|
||||
p.store w, null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classes {
|
||||
dependsOn createProperties
|
||||
}
|
35
src/java/com/wasteinformationserver/basicutils/Info.java
Normal file
35
src/java/com/wasteinformationserver/basicutils/Info.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.wasteinformationserver.basicutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Info {
|
||||
public static String version="0.0";
|
||||
public static String builddate;
|
||||
|
||||
|
||||
public static void init(){
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
|
||||
URL url = Info.class.getResource("/version.properties");
|
||||
|
||||
String builddatee = format.format(new Date(new File(url.toURI()).lastModified()));
|
||||
builddate=builddatee;
|
||||
|
||||
prop.load(url.openStream());
|
||||
version=(String)prop.get("version");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +1,17 @@
|
||||
package com.wasteinformationserver;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.mqtt.mqtt;
|
||||
import com.wasteinformationserver.website.Webserver;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Log.setLevel(Log.DEBUG);
|
||||
Log.info("startup of WasteInformationServer");
|
||||
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
@ -24,6 +25,10 @@ public class main {
|
||||
}
|
||||
}));
|
||||
|
||||
Info.init();
|
||||
Log.info("Server version: "+Info.version);
|
||||
Log.debug("Build date: "+Info.builddate);
|
||||
|
||||
//initial connect to db
|
||||
Log.message("initial login to db");
|
||||
new Thread(() -> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
@ -168,6 +169,16 @@ public class DataRequest extends PostRequest {
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "getversionandbuildtime":
|
||||
sb.append("{");
|
||||
|
||||
sb.append("\"version\" : \""+ Info.version+"\"");
|
||||
sb.append(",\"buildtime\" : \""+ Info.builddate+"\"");
|
||||
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
|
@ -379,7 +379,7 @@
|
||||
<!-- /.content-wrapper -->
|
||||
<footer class="main-footer">
|
||||
<strong>By Gregor Dutzler & Lukas Heiligenbrunner & Emil Meindl</strong>
|
||||
<div class="float-right d-none d-sm-inline-block">
|
||||
<div id="version-footer-label" class="float-right d-none d-sm-inline-block">
|
||||
<b>Version</b> 3.0.0
|
||||
<b>Build</b> 2019-8-8 9:30
|
||||
</div>
|
||||
|
@ -30,6 +30,13 @@ $(document).ready(function () {
|
||||
$("#finished-collection-label").html(data.collectionnumber);
|
||||
}, 'json');
|
||||
|
||||
//load version footer
|
||||
//
|
||||
$.post('/senddata/wastedata', 'action=getversionandbuildtime', function (data) {
|
||||
$("#version-footer-label").html("<b>Version</b> "+data.version+" <b>Build</b> "+data.buildtime);
|
||||
}, 'json');
|
||||
|
||||
|
||||
var citytable;
|
||||
|
||||
function reloadtable() {
|
||||
|
BIN
src/resources/wwwroot/wasteicon.png
Normal file
BIN
src/resources/wwwroot/wasteicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue
Block a user