Skip to content

Commit

Permalink
Removed NitriteDB as main database, instead using ObjectMapper and pl…
Browse files Browse the repository at this point in the history
…ain JSON (faster and stable)
  • Loading branch information
hydrogen2oxygen committed Dec 19, 2022
1 parent f7f0b06 commit 21e1f6b
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 139 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Upload Artifact - Make Directory
run: |
mkdir -p finalApproach;
cp server/target/server-1.0.31.jar finalApproach/server.jar;
cp updater/target/updater-1.0.31-jar-with-dependencies.jar finalApproach/launcher.jar;
cp updater/target/updater-1.0.31-jar-with-dependencies.jar finalApproach/newlauncher.jar;
cp server/target/server-1.1.0.jar finalApproach/server.jar;
cp updater/target/updater-1.1.0-jar-with-dependencies.jar finalApproach/launcher.jar;
cp updater/target/updater-1.1.0-jar-with-dependencies.jar finalApproach/newlauncher.jar;
cp scripts/start.bat finalApproach/;
- uses: actions/upload-artifact@v3
with:
name: final-approach-1.0.31
name: final-approach-1.1.0
path: finalApproach
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<packaging>pom</packaging>

<properties>
<revision>1.0.31</revision>
<revision>1.1.0</revision>
<version.info>hide outline polygon button</version.info>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>

<version>1.0.31</version>
<version>1.1.0</version>
<groupId>de.pietro.lusso</groupId>
<artifactId>server</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Version version() throws IOException {
}

@GetMapping
public Congregation getCongregation() {
public Congregation getCongregation() throws IOException {
return databaseService.loadCongregation();
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public void exportAllTerritoryData() throws Exception {
}

@PutMapping
public Congregation saveCongregation(@RequestBody Congregation congregation) {
public Congregation saveCongregation(@RequestBody Congregation congregation) throws IOException {

return databaseService.saveCongregation(congregation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("map/")
@CrossOrigin(origins = "*", allowedHeaders = "*")
Expand All @@ -26,18 +28,18 @@ public String status() {
}

@GetMapping
public MapDesign getMapDesign() {
public MapDesign getMapDesign() throws IOException {
return databaseService.loadMapDesign();
}

@PutMapping
public MapDesign saveMapDesign(@RequestBody MapDesign mapDesign) {
public MapDesign saveMapDesign(@RequestBody MapDesign mapDesign) throws IOException {

return databaseService.saveMapDesign(mapDesign);
}

@PutMapping("territoryMap")
public TerritoryMap saveTerritoryMap(@RequestBody TerritoryMap territoryMap) {
public TerritoryMap saveTerritoryMap(@RequestBody TerritoryMap territoryMap) throws IOException {

return databaseService.saveTerritoryMap(territoryMap);
}
Expand All @@ -49,7 +51,7 @@ public MapDesign setActiveTerritory(@PathVariable String number, @PathVariable S
}

@DeleteMapping("territoryMap/{number}")
public MapDesign deleteTerritoryMap(@PathVariable String number) {
public MapDesign deleteTerritoryMap(@PathVariable String number) throws IOException {

MapDesign mapDesign = databaseService.loadMapDesign();
TerritoryMap territoryMap = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("settings/")
@CrossOrigin(origins = "*", allowedHeaders = "*")
Expand All @@ -24,12 +26,12 @@ public String status() {
}

@GetMapping
public Settings getSettings() {
public Settings getSettings() throws IOException {
return databaseService.loadSettings();
}

@PutMapping
public Settings saveMapDesign(@RequestBody Settings settings) {
public Settings saveMapDesign(@RequestBody Settings settings) throws IOException {
databaseService.saveSettings(settings);
return settings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,7 @@ public class UtilityAdapter {
@GetMapping("shutdown")
public void shutDown() {

Executor executor = Executors.newSingleThreadExecutor();
executor.execute(() -> {

logger.info("received shutdown request");
databaseService.shutdown();
int seconds = 1;

while (databaseService.isClosed()) {
try {
Thread.sleep(1000);
logger.info("wait " + seconds + " second");
seconds++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}

logger.info("shutting down server");
System.exit(0);
});
System.exit(0);
}

@PostMapping("importTerritoriesFromText")
Expand Down
Loading

0 comments on commit 21e1f6b

Please sign in to comment.