diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index 9537c72..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Java CI
-
-on:
- push:
- branches:
- - 'main'
- - 'develop'
- pull_request:
- branches:
- - 'main'
- - 'develop'
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v3
-
- - name: Set up JDK 17
- uses: actions/setup-java@v3
- with:
- java-version: 17
- distribution: 'temurin'
-
- - name: Build with Maven
- run: mvn -B clean install
-
- - name: Run JUnit tests
- run: mvn test
diff --git a/GlobalQuakeAPI/pom.xml b/GlobalQuakeAPI/pom.xml
deleted file mode 100644
index 8d0b2fa..0000000
--- a/GlobalQuakeAPI/pom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- 4.0.0
-
- xspanger.GlobalQuake
- GlobalQuakeServer
- 0.1.0
- ../pom.xml
-
-
- GlobalQuakeAPI
-
-
- 17
- 17
- UTF-8
-
-
-
\ No newline at end of file
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/Packet.java b/GlobalQuakeAPI/src/main/java/gqserver/api/Packet.java
deleted file mode 100644
index 15615dd..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/Packet.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package gqserver.api;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-public interface Packet extends Serializable {
-
- default void onServerReceive(ServerClient serverClient) throws IOException {}
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/ServerClient.java b/GlobalQuakeAPI/src/main/java/gqserver/api/ServerClient.java
deleted file mode 100644
index a4f937b..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/ServerClient.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package gqserver.api;
-
-import gqserver.api.data.system.ServerClientConfig;
-import gqserver.api.exception.UnknownPacketException;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.Socket;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class ServerClient {
-
- private static final AtomicInteger nextID = new AtomicInteger(0);
- private final Socket socket;
- private final int id;
-
- private final ObjectInputStream inputStream;
- private final ObjectOutputStream outputStream;
-
- private final long joinTime;
- private long lastHeartbeat;
-
- private long receivedPackets = 0;
-
- private long sentPackets = 0;
-
- private ServerClientConfig clientConfig;
-
- public ServerClient(Socket socket) throws IOException {
- this.socket = socket;
- this.inputStream = new ObjectInputStream(socket.getInputStream());
- this.outputStream = new ObjectOutputStream(socket.getOutputStream());
- this.id = nextID.getAndIncrement();
- this.joinTime = System.currentTimeMillis();
- this.lastHeartbeat = joinTime;
- }
-
- private ObjectInputStream getInputStream() {
- return inputStream;
- }
-
- private ObjectOutputStream getOutputStream() {
-
- return outputStream;
- }
-
- public Packet readPacket() throws IOException, UnknownPacketException {
- try {
- Object obj = getInputStream().readObject();
- if(obj instanceof Packet){
- receivedPackets++;
- return (Packet) obj;
- }
-
- throw new UnknownPacketException("Received obj not instance of Packet!", null);
- }catch(ClassNotFoundException e){
- throw new UnknownPacketException(e.getMessage(), e);
- }
- }
-
- public void setClientConfig(ServerClientConfig clientConfig) {
- this.clientConfig = clientConfig;
- }
-
- public ServerClientConfig getClientConfig() {
- return clientConfig;
- }
-
- public synchronized void sendPacket(Packet packet) throws IOException{
- getOutputStream().writeObject(packet);
- sentPackets++;
- }
-
- public void destroy() throws IOException {
- socket.close();
- }
-
- public int getID() {
- return id;
- }
-
- public long getJoinTime() {
- return joinTime;
- }
-
- public LocalDateTime getJoinDate(){
- return Instant.ofEpochMilli(getJoinTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
- }
-
- public boolean isConnected() {
- return socket.isConnected() && !socket.isClosed();
- }
-
- public void noteHeartbeat() {
- lastHeartbeat = System.currentTimeMillis();
- }
-
- public long getLastHeartbeat() {
- return lastHeartbeat;
- }
-
- public long getDelay(){
- return System.currentTimeMillis() - getLastHeartbeat();
- }
-
- public Socket getSocket() {
- return socket;
- }
-
- public long getReceivedPackets() {
- return receivedPackets;
- }
-
- public long getSentPackets() {
- return sentPackets;
- }
-
- public void flush() throws IOException {
- getOutputStream().flush();
- }
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/EarthquakeInfo.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/EarthquakeInfo.java
deleted file mode 100644
index fcbbe7a..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/EarthquakeInfo.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package gqserver.api.data.earthquake;
-
-import java.io.Serializable;
-import java.util.UUID;
-
-public record EarthquakeInfo(UUID uuid, int revisionID) implements Serializable {
-
- public static final int REMOVED = -1;
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/HypocenterData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/HypocenterData.java
deleted file mode 100644
index a8d545d..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/HypocenterData.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package gqserver.api.data.earthquake;
-
-import java.io.Serializable;
-import java.util.UUID;
-
-public record HypocenterData(UUID uuid, int revisionID, float lat, float lon, float depth, long origin, float magnitude) implements Serializable {
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/AdvancedHypocenterData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/AdvancedHypocenterData.java
deleted file mode 100644
index e1ffe4c..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/AdvancedHypocenterData.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package gqserver.api.data.earthquake.advanced;
-
-import java.io.Serializable;
-
-public record AdvancedHypocenterData(HypocenterQualityData qualityData,
- DepthConfidenceIntervalData depthIntervalData,
- LocationConfidenceIntervalData locationConfidenceIntervalData) implements Serializable {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/DepthConfidenceIntervalData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/DepthConfidenceIntervalData.java
deleted file mode 100644
index 3f6a0a9..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/DepthConfidenceIntervalData.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package gqserver.api.data.earthquake.advanced;
-
-import java.io.Serializable;
-
-public record DepthConfidenceIntervalData(float minDepth, float maxDepth) implements Serializable {
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/HypocenterQualityData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/HypocenterQualityData.java
deleted file mode 100644
index c323b02..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/HypocenterQualityData.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package gqserver.api.data.earthquake.advanced;
-
-import java.io.Serializable;
-
-public record HypocenterQualityData(float errOrigin, float errDepth, float errNS, float errEW, int stations, float pct) implements Serializable {
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/LocationConfidenceIntervalData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/LocationConfidenceIntervalData.java
deleted file mode 100644
index 3642af1..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/LocationConfidenceIntervalData.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package gqserver.api.data.earthquake.advanced;
-
-import java.io.Serializable;
-import java.util.List;
-
-public record LocationConfidenceIntervalData(List polygonConfidenceIntervalDataList) implements Serializable {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/PolygonConfidenceIntervalData.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/PolygonConfidenceIntervalData.java
deleted file mode 100644
index bd178ab..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/earthquake/advanced/PolygonConfidenceIntervalData.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package gqserver.api.data.earthquake.advanced;
-
-import java.io.Serializable;
-import java.util.List;
-
-public record PolygonConfidenceIntervalData(int n, float offset, List lengths) implements Serializable {
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/data/system/ServerClientConfig.java b/GlobalQuakeAPI/src/main/java/gqserver/api/data/system/ServerClientConfig.java
deleted file mode 100644
index 524e0f5..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/data/system/ServerClientConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package gqserver.api.data.system;
-
-import java.io.Serializable;
-
-public record ServerClientConfig(boolean earthquakeData, boolean stationData) implements Serializable {
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/exception/UnknownPacketException.java b/GlobalQuakeAPI/src/main/java/gqserver/api/exception/UnknownPacketException.java
deleted file mode 100644
index 7bf7553..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/exception/UnknownPacketException.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package gqserver.api.exception;
-
-public class UnknownPacketException extends Throwable {
- public UnknownPacketException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeCheckPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeCheckPacket.java
deleted file mode 100644
index 581fb76..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeCheckPacket.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package gqserver.api.packets.earthquake;
-
-import gqserver.api.Packet;
-import gqserver.api.data.earthquake.EarthquakeInfo;
-
-public record EarthquakeCheckPacket(EarthquakeInfo info) implements Packet {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeRequestPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeRequestPacket.java
deleted file mode 100644
index 755bf75..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakeRequestPacket.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package gqserver.api.packets.earthquake;
-
-import gqserver.api.Packet;
-
-import java.util.UUID;
-
-public record EarthquakeRequestPacket(UUID uuid) implements Packet {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakesRequestPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakesRequestPacket.java
deleted file mode 100644
index b8f3b7e..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/EarthquakesRequestPacket.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package gqserver.api.packets.earthquake;
-
-import gqserver.api.Packet;
-
-public record EarthquakesRequestPacket() implements Packet {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/HypocenterDataPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/HypocenterDataPacket.java
deleted file mode 100644
index 9faa9bf..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/earthquake/HypocenterDataPacket.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package gqserver.api.packets.earthquake;
-
-import gqserver.api.Packet;
-import gqserver.api.data.earthquake.HypocenterData;
-import gqserver.api.data.earthquake.advanced.AdvancedHypocenterData;
-
-public record HypocenterDataPacket(HypocenterData data, AdvancedHypocenterData advancedHypocenterData) implements Packet {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HandshakePacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HandshakePacket.java
deleted file mode 100644
index 23d2be6..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HandshakePacket.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package gqserver.api.packets.system;
-
-import gqserver.api.Packet;
-import gqserver.api.data.system.ServerClientConfig;
-
-public record HandshakePacket(int compatVersion, ServerClientConfig clientConfig) implements Packet {
-
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HeartbeatPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HeartbeatPacket.java
deleted file mode 100644
index 9206b20..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/HeartbeatPacket.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package gqserver.api.packets.system;
-
-import gqserver.api.Packet;
-import gqserver.api.ServerClient;
-
-import java.io.IOException;
-
-public record HeartbeatPacket() implements Packet {
-
- @Override
- public void onServerReceive(ServerClient serverClient) throws IOException {
- serverClient.noteHeartbeat();
- serverClient.sendPacket(new HeartbeatPacket());
- }
-}
diff --git a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/TerminationPacket.java b/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/TerminationPacket.java
deleted file mode 100644
index 445a445..0000000
--- a/GlobalQuakeAPI/src/main/java/gqserver/api/packets/system/TerminationPacket.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package gqserver.api.packets.system;
-
-import gqserver.api.Packet;
-
-public record TerminationPacket(String cause) implements Packet {
-}
diff --git a/GlobalQuakeCore/pom.xml b/GlobalQuakeCore/pom.xml
deleted file mode 100644
index 024f3ed..0000000
--- a/GlobalQuakeCore/pom.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
- 4.0.0
-
- xspanger.GlobalQuake
- GlobalQuakeServer
- 0.1.0
- ../pom.xml
-
-
- GlobalQuakeCore
- 0.10.0
-
-
- 17
- 17
- UTF-8
-
-
-
-
- org.tinylog
- tinylog-api
- 2.5.0
-
-
- org.tinylog
- tinylog-impl
- 2.5.0
-
-
- edu.sc.seis
- seisFile
- 2.0.6
-
-
-
- de.grundid.opendatalab
- geojson-jackson
- 1.14
-
-
-
- edu.sc.seis
- seedCodec
- 1.1.1
-
-
-
- edu.sc.seis
- TauP
- 2.6.1
-
-
- uk.me.berndporr
- iirj
- 1.3
-
-
-
- com.github.wendykierp
- JTransforms
- 3.1
-
-
- org.json
- json
- 20230227
-
-
-
-
\ No newline at end of file
diff --git a/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuake.java b/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuake.java
deleted file mode 100644
index ad423dc..0000000
--- a/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuake.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package globalquake.core;
-
-import globalquake.core.archive.EarthquakeArchive;
-import globalquake.core.database.StationDatabaseManager;
-import globalquake.core.earthquake.ClusterAnalysis;
-import globalquake.core.earthquake.EarthquakeAnalysis;
-import globalquake.core.events.GlobalQuakeEventHandler;
-import globalquake.core.exception.ApplicationErrorHandler;
-import globalquake.core.station.GlobalStationManager;
-
-import java.io.File;
-
-public class GlobalQuake {
-
- private final GlobalQuakeRuntime globalQuakeRuntime;
- private final SeedlinkNetworksReader seedlinkNetworksReader;
- private final StationDatabaseManager stationDatabaseManager;
- private final ClusterAnalysis clusterAnalysis;
- private final EarthquakeAnalysis earthquakeAnalysis;
- private final EarthquakeArchive archive;
-
- private final GlobalQuakeEventHandler eventHandler;
-
- public static GlobalQuake instance;
-
- private final GlobalStationManager globalStationManager;
-
- private final ApplicationErrorHandler errorHandler;
- private final File mainFolder;
-
-
- public GlobalQuake(StationDatabaseManager stationDatabaseManager,
- ApplicationErrorHandler errorHandler,
- File mainFolder) {
- instance = this;
- this.mainFolder = mainFolder;
- this.errorHandler = errorHandler;
- this.stationDatabaseManager = stationDatabaseManager;
-
- eventHandler = new GlobalQuakeEventHandler().runHandler();
-
- globalStationManager = new GlobalStationManager();
-
- earthquakeAnalysis = new EarthquakeAnalysis();
- clusterAnalysis = new ClusterAnalysis();
-
- archive = new EarthquakeArchive().loadArchive();
-
- globalQuakeRuntime = new GlobalQuakeRuntime();
- seedlinkNetworksReader = new SeedlinkNetworksReader();
- }
-
- public void startRuntime(){
- globalStationManager.initStations(stationDatabaseManager);
- getGlobalQuakeRuntime().runThreads();
- seedlinkNetworksReader.run();
- }
-
- public void stopRuntime(){
- getGlobalQuakeRuntime().stop();
- getSeedlinkReader().stop();
-
- getEarthquakeAnalysis().getEarthquakes().clear();
- getClusterAnalysis().getClusters().clear();
- getStationManager().getStations().clear();
- }
-
- public ClusterAnalysis getClusterAnalysis() {
- return clusterAnalysis;
- }
-
- public EarthquakeAnalysis getEarthquakeAnalysis() {
- return earthquakeAnalysis;
- }
-
- public EarthquakeArchive getArchive() {
- return archive;
- }
-
- public GlobalStationManager getStationManager() {
- return globalStationManager;
- }
-
- public GlobalQuakeRuntime getGlobalQuakeRuntime() {
- return globalQuakeRuntime;
- }
-
- public SeedlinkNetworksReader getSeedlinkReader() {
- return seedlinkNetworksReader;
- }
-
- public StationDatabaseManager getStationDatabaseManager() {
- return stationDatabaseManager;
- }
-
- public GlobalQuakeEventHandler getEventHandler() {
- return eventHandler;
- }
-
- public ApplicationErrorHandler getErrorHandler() {
- return errorHandler;
- }
-
- public File getMainFolder() {
- return mainFolder;
- }
-}
diff --git a/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuakeRuntime.java b/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuakeRuntime.java
deleted file mode 100644
index 38c997a..0000000
--- a/GlobalQuakeCore/src/main/java/globalquake/core/GlobalQuakeRuntime.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package globalquake.core;
-
-import globalquake.core.station.AbstractStation;
-import globalquake.utils.NamedThreadFactory;
-import org.tinylog.Logger;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-@SuppressWarnings("unused")
-public class GlobalQuakeRuntime {
-
- private long lastSecond;
- private long lastAnalysis;
- private long lastGC;
- private long clusterAnalysisT;
- private long lastQuakesT;
- private ScheduledExecutorService execAnalysis;
- private ScheduledExecutorService exec1Sec;
- private ScheduledExecutorService execClusters;
- private ScheduledExecutorService execQuake;
-
- public void runThreads() {
- execAnalysis = Executors
- .newSingleThreadScheduledExecutor(new NamedThreadFactory("Station Analysis Thread"));
- exec1Sec = Executors
- .newSingleThreadScheduledExecutor(new NamedThreadFactory("1-Second Loop Thread"));
- execClusters = Executors
- .newSingleThreadScheduledExecutor(new NamedThreadFactory("Cluster Analysis Thread"));
- execQuake = Executors
- .newSingleThreadScheduledExecutor(new NamedThreadFactory("Hypocenter Location Thread"));
-
- execAnalysis.scheduleAtFixedRate(() -> {
- try {
- long a = System.currentTimeMillis();
- GlobalQuake.instance.getStationManager().getStations().parallelStream().forEach(AbstractStation::analyse);
- lastAnalysis = System.currentTimeMillis() - a;
- } catch (Exception e) {
- Logger.error("Exception occurred in station analysis");
- GlobalQuake.instance.getErrorHandler().handleException(e);
- }
- }, 0, 100, TimeUnit.MILLISECONDS);
-
- exec1Sec.scheduleAtFixedRate(() -> {
- try {
- long a = System.currentTimeMillis();
- GlobalQuake.instance.getStationManager().getStations().parallelStream().forEach(station -> station.second(a));
- if (GlobalQuake.instance.getEarthquakeAnalysis() != null) {
- GlobalQuake.instance.getEarthquakeAnalysis().second();
- }
- lastSecond = System.currentTimeMillis() - a;
- } catch (Exception e) {
- Logger.error("Exception occurred in 1-second loop");
- GlobalQuake.instance.getErrorHandler().handleException(e);
- }
- }, 0, 1, TimeUnit.SECONDS);
-
- execClusters.scheduleAtFixedRate(() -> {
- try {
- long a = System.currentTimeMillis();
- GlobalQuake.instance.getClusterAnalysis().run();
- clusterAnalysisT = System.currentTimeMillis() - a;
- } catch (Exception e) {
- Logger.error("Exception occurred in cluster analysis loop");
- GlobalQuake.instance.getErrorHandler().handleException(e);
- }
- }, 0, 500, TimeUnit.MILLISECONDS);
-
- execQuake.scheduleAtFixedRate(() -> {
- try {
- long a = System.currentTimeMillis();
- GlobalQuake.instance.getEarthquakeAnalysis().run();
- lastQuakesT = System.currentTimeMillis() - a;
- } catch (Exception e) {
- Logger.error("Exception occurred in hypocenter location loop");
- GlobalQuake.instance.getErrorHandler().handleException(e);
- }
- }, 0, 1, TimeUnit.SECONDS);
- }
-
- @SuppressWarnings("ResultOfMethodCallIgnored")
- public void stop() {
- execAnalysis.shutdownNow();
- execQuake.shutdownNow();
- execClusters.shutdownNow();
- exec1Sec.shutdownNow();
-
- try {
- execAnalysis.awaitTermination(10, TimeUnit.SECONDS);
- execQuake.awaitTermination(10, TimeUnit.SECONDS);
- execClusters.awaitTermination(10, TimeUnit.SECONDS);
- exec1Sec.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- Logger.error(e);
- }
- }
-}
diff --git a/GlobalQuakeCore/src/main/java/globalquake/core/SeedlinkNetworksReader.java b/GlobalQuakeCore/src/main/java/globalquake/core/SeedlinkNetworksReader.java
deleted file mode 100644
index 8cda817..0000000
--- a/GlobalQuakeCore/src/main/java/globalquake/core/SeedlinkNetworksReader.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package globalquake.core;
-
-import globalquake.core.database.SeedlinkNetwork;
-import globalquake.core.database.SeedlinkStatus;
-import globalquake.core.station.AbstractStation;
-import globalquake.core.station.GlobalStation;
-import edu.sc.seis.seisFile.mseed.DataRecord;
-import edu.sc.seis.seisFile.seedlink.SeedlinkPacket;
-import edu.sc.seis.seisFile.seedlink.SeedlinkReader;
-import org.tinylog.Logger;
-
-import java.time.Instant;
-import java.util.*;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-public class SeedlinkNetworksReader {
-
- protected static final int RECONNECT_DELAY = 10;
- private Instant lastData;
-
- private long lastReceivedRecord;
-
- private ExecutorService seedlinkReaderService;
-
- private final Queue activeReaders = new ConcurrentLinkedQueue<>();
-
- public static void main(String[] args) throws Exception{
- SeedlinkReader reader = new SeedlinkReader("rtserve.iris.washington.edu", 18000);
- reader.select("AK", "D25K", "", "BHZ");
- reader.startData();
-
- SortedSet set = new TreeSet<>(Comparator.comparing(dataRecord -> dataRecord.getStartBtime().toInstant().toEpochMilli()));
-
- while(reader.hasNext() && set.size() < 10){
- SeedlinkPacket pack = reader.readPacket();
- DataRecord dataRecord = pack.getMiniSeed();
- System.out.println(pack.getMiniSeed().getStartTime()+" - "+pack.getMiniSeed().getLastSampleTime()+" x "+pack.getMiniSeed().getEndTime()+" @ "+pack.getMiniSeed().getSampleRate());
- System.out.println(pack.getMiniSeed().getControlHeader().getSequenceNum());
- if(!set.add(dataRecord)){
- System.out.println("ERR ALREADY CONTAINS");
- }
- }
-
- reader.close();
- for(DataRecord dataRecord : set){
- System.err.println(dataRecord.getStartTime()+" - "+dataRecord.getLastSampleTime()+" x "+dataRecord.getEndTime()+" @ "+dataRecord.getSampleRate());
- System.err.println(dataRecord.oneLineSummary());
- }
- }
-
- public void run() {
- createCache();
- seedlinkReaderService = Executors.newCachedThreadPool();
- GlobalQuake.instance.getStationDatabaseManager().getStationDatabase().getDatabaseReadLock().lock();
- try{
- GlobalQuake.instance.getStationDatabaseManager().getStationDatabase().getSeedlinkNetworks().forEach(
- seedlinkServer -> seedlinkReaderService.submit(() -> runSeedlinkThread(seedlinkServer, RECONNECT_DELAY)));
- } finally {
- GlobalQuake.instance.getStationDatabaseManager().getStationDatabase().getDatabaseReadLock().unlock();
- }
- }
-
- private final Map stationCache = new HashMap<>();
-
- private void createCache() {
- for (AbstractStation s : GlobalQuake.instance.getStationManager().getStations()) {
- if (s instanceof GlobalStation) {
- stationCache.put("%s %s".formatted(s.getNetworkCode(), s.getStationCode()), (GlobalStation) s);
- }
- }
- }
- private void runSeedlinkThread(SeedlinkNetwork seedlinkNetwork, int reconnectDelay) {
- seedlinkNetwork.status = SeedlinkStatus.CONNECTING;
- seedlinkNetwork.connectedStations = 0;
-
- SeedlinkReader reader = null;
- try {
- Logger.info("Connecting to seedlink server \"" + seedlinkNetwork.getHost() + "\"");
- reader = new SeedlinkReader(seedlinkNetwork.getHost(), seedlinkNetwork.getPort(), 90, false);
- activeReaders.add(reader);
-
- reader.sendHello();
-
- reconnectDelay = RECONNECT_DELAY; // if connect succeeded then reset the delay
- boolean first = true;
-
- for (AbstractStation s : GlobalQuake.instance.getStationManager().getStations()) {
- if (s.getSeedlinkNetwork() != null && s.getSeedlinkNetwork().equals(seedlinkNetwork)) {
- Logger.trace("Connecting to %s %s %s %s [%s]".formatted(s.getStationCode(), s.getNetworkCode(), s.getChannelName(), s.getLocationCode(), seedlinkNetwork.getName()));
- if(!first) {
- reader.sendCmd("DATA");
- } else{
- first = false;
- }
- reader.select(s.getNetworkCode(), s.getStationCode(), s.getLocationCode(),
- s.getChannelName());
- seedlinkNetwork.connectedStations++;
- }
- }
-
- if(seedlinkNetwork.connectedStations == 0){
- Logger.info("No stations connected to "+seedlinkNetwork.getName());
- seedlinkNetwork.status = SeedlinkStatus.DISCONNECTED;
- return;
- }
-
- reader.startData();
- seedlinkNetwork.status = SeedlinkStatus.RUNNING;
-
- while (reader.hasNext()) {
- SeedlinkPacket slp = reader.readPacket();
- try {
- newPacket(slp.getMiniSeed());
- } catch (Exception e) {
- Logger.error(e);
- }
- }
-
- reader.close();
- } catch (Exception e) {
- Logger.error(e);
- if (reader != null) {
- try {
- reader.close();
- } catch (Exception ex) {
- Logger.error(ex);
- }
- }
- }finally{
- if(reader != null){
- activeReaders.remove(reader);
- }
- }
-
- seedlinkNetwork.status = SeedlinkStatus.DISCONNECTED;
- seedlinkNetwork.connectedStations = 0;
- Logger.warn(seedlinkNetwork.getHost() + " Disconnected, Reconnecting after " + reconnectDelay
- + " seconds...");
-
- try {
- Thread.sleep(reconnectDelay * 1000L);
- if(reconnectDelay < 60 * 5) {
- reconnectDelay *= 2;
- }
- } catch (InterruptedException ignored) {
- Logger.warn("Thread interrupted, nothing will happen");
- return;
- }
-
- int finalReconnectDelay = reconnectDelay;
- seedlinkReaderService.submit(() -> runSeedlinkThread(seedlinkNetwork, finalReconnectDelay));
- }
-
- private void newPacket(DataRecord dr) {
- if (lastData == null || dr.getLastSampleBtime().toInstant().isAfter(lastData)) {
- lastData = dr.getLastSampleBtime().toInstant();
- }
-
- String network = dr.getHeader().getNetworkCode().replaceAll(" ", "");
- String station = dr.getHeader().getStationIdentifier().replaceAll(" ", "");
- var globalStation = stationCache.get("%s %s".formatted(network, station));
- if(globalStation == null){
- Logger.trace("Warning! Seedlink sent data for %s %s, but that was never selected!!!".formatted(network, station));
- }else {
- globalStation.addRecord(dr);
- }
- }
-
- public long getLastReceivedRecord() {
- return lastReceivedRecord;
- }
-
- public void logRecord(long time) {
- if (time > lastReceivedRecord && time <= System.currentTimeMillis()) {
- lastReceivedRecord = time;
- }
- }
-
- @SuppressWarnings("ResultOfMethodCallIgnored")
- public void stop() {
- if(seedlinkReaderService != null) {
- System.err.println("INT SDL");
- seedlinkReaderService.shutdownNow();
- for (Iterator iterator = activeReaders.iterator(); iterator.hasNext(); ) {
- SeedlinkReader reader = iterator.next();
- reader.close();
- iterator.remove();
- }
- try {
- seedlinkReaderService.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- Logger.error(e);
- }
-
- System.err.println("INT SDL DONE");
- }
- stationCache.clear();
- }
-}
diff --git a/GlobalQuakeCore/src/main/java/globalquake/core/Settings.java b/GlobalQuakeCore/src/main/java/globalquake/core/Settings.java
deleted file mode 100644
index 0226387..0000000
--- a/GlobalQuakeCore/src/main/java/globalquake/core/Settings.java
+++ /dev/null
@@ -1,339 +0,0 @@
-package globalquake.core;
-
-import globalquake.core.exception.RuntimeApplicationException;
-import globalquake.core.geo.DistanceUnit;
-import globalquake.core.intensity.IntensityScales;
-import org.tinylog.Logger;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.TemporalAccessor;
-import java.util.Properties;
-
-import java.lang.reflect.Field;
-import java.util.function.Function;
-
-public final class Settings {
-
- private static final File optionsFile = new File(GlobalQuake.instance.getMainFolder(), "globalQuake.properties");
- private static final Properties properties = new Properties();
-
- public static Double homeLat;
- public static Double homeLon;
-
- public static final double pWaveInaccuracyThresholdDefault = 1800;
- public static Double pWaveInaccuracyThreshold;
- public static final double hypocenterCorrectThresholdDefault = 50;
- public static Double hypocenterCorrectThreshold;
-
- public static final double hypocenterDetectionResolutionDefault = 40;
- public static final double hypocenterDetectionResolutionMax = 160.0;
- public static Double hypocenterDetectionResolution;
-
- public static Boolean parallelHypocenterLocations;
- public static final int minimumStationsForEEWDefault = 5;
-
- public static Integer minimumStationsForEEW;
-
- public static Boolean displayArchivedQuakes;
-
- public static Boolean useOldColorScheme;
-
- public static Boolean displayHomeLocation;
-
- public static Boolean antialiasing;
-
- public static Integer fpsIdle;
-
- public static Integer intensityScaleIndex;
-
- public static Boolean reportsEnabled = false;
- public static Boolean enableSound = true;
- public static Boolean oldEventsTimeFilterEnabled;
- public static Double oldEventsTimeFilter;
- public static Boolean oldEventsMagnitudeFilterEnabled;
- public static Double oldEventsMagnitudeFilter;
-
- public static int changes = 0;
-
- public static Double oldEventsOpacity;
-
- public static Boolean displayClusters;
- public static Integer selectedDateFormatIndex;
-
- public static Integer maxArchivedQuakes;
-
- public static final DateTimeFormatter[] DATE_FORMATS = {
- DateTimeFormatter.ofPattern("dd/MM/yyyy").withZone(ZoneId.systemDefault()),
- DateTimeFormatter.ofPattern("MM/dd/yyyy").withZone(ZoneId.systemDefault()),
- DateTimeFormatter.ofPattern("yyyy/MM/dd").withZone(ZoneId.systemDefault()),
- };
-
- public static Boolean use24HFormat;
- public static Double stationIntensityVisibilityZoomLevel;
- public static Boolean hideDeadStations;
-
- public static final DateTimeFormatter formatter24H = DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.systemDefault());
- public static final DateTimeFormatter formatter12H = DateTimeFormatter.ofPattern("hh:mm:ss").withZone(ZoneId.systemDefault());
-
- public static Boolean alertLocal;
- public static Double alertLocalDist;
- public static Boolean alertRegion;
- public static Double alertRegionMag;
- public static Double alertRegionDist;
- public static Boolean alertGlobal;
- public static Double alertGlobalMag;
-
- public static Integer cinemaModeSwitchTime;
- public static Integer cinemaModeZoomMultiplier;
-
- public static Boolean cinemaModeOnStartup;
- public static Boolean cinemaModeReenable;
-
- public static Integer logsStoreTimeMinutes;
- public static Integer maxEvents;
- public static final int maxEventsDefault = 60;
- public static Boolean displayCoreWaves;
- public static Boolean recalibrateOnLaunch;
- public static Boolean stationsTriangles;
- public static Double stationsSizeMul;
- public static Integer selectedEventColorIndex;
-
- public static Integer distanceUnitsIndex;
- public static Boolean focusOnEvent;
- public static Boolean jumpToAlert;
-
- public static Boolean confidencePolygons;
-
- public static Boolean displayAdditionalQuakeInfo;
-
- public static Boolean displayMagnitudeHistogram;
-
- public static Boolean displaySystemInfo;
- public static Boolean reduceRevisions;
-
- public static Integer shakingLevelScale;
- public static Integer shakingLevelIndex;
-
- public static Integer strongShakingLevelScale;
- public static Integer strongShakingLevelIndex;
-
- public static Boolean displayAlertBox;
- public static Boolean displayTime;
-
- static {
- load();
- }
-
- private static void load() {
- try {
- properties.load(new FileInputStream(optionsFile));
- } catch (IOException e) {
- Logger.info("Created GlobalQuake properties file at "+optionsFile.getAbsolutePath());
- }
-
- loadProperty("shakingLevelScale", "0",
- o -> validateInt(0, IntensityScales.INTENSITY_SCALES.length - 1, (Integer) o));
- loadProperty("shakingLevelIndex", "0",
- o -> validateInt(0, IntensityScales.INTENSITY_SCALES[shakingLevelScale].getLevels().size() - 1, (Integer) o));
-
- loadProperty("strongShakingLevelScale", "0",
- o -> validateInt(0, IntensityScales.INTENSITY_SCALES.length - 1, (Integer) o));
- loadProperty("strongShakingLevelIndex", "5",
- o -> validateInt(0, IntensityScales.INTENSITY_SCALES[strongShakingLevelScale].getLevels().size() - 1, (Integer) o));
-
- loadProperty("reduceRevisions", "true");
-
- loadProperty("displayTime", "true");
- loadProperty("displayAlertBox", "true");
- loadProperty("displaySystemInfo", "true");
- loadProperty("displayMagnitudeHistogram", "true");
- loadProperty("displayAdditionalQuakeInfo", "false");
-
- loadProperty("confidencePolygons", "false");
-
- loadProperty("focusOnEvent", "true");
- loadProperty("jumpToAlert", "true");
-
- loadProperty("distanceUnitsIndex", "0", o -> validateInt(0, DistanceUnit.values().length - 1, (Integer) o));
-
- loadProperty("selectedEventColorIndex", "0", o -> validateInt(0, 2, (Integer) o));
- loadProperty("stationsSizeMul", "1.0", o -> validateDouble(0, 10, (Double) o));
- loadProperty("recalibrateOnLaunch", "true");
-
- loadProperty("displayCoreWaves", "false");
- loadProperty("maxEvents", String.valueOf(maxEventsDefault));
-
- loadProperty("logsStoreTimeMinutes", "5", o -> validateInt(1, 60, (Integer) o));
-
- loadProperty("cinemaModeOnStartup", "true");
- loadProperty("cinemaModeReenable", "true");
- loadProperty("cinemaModeSwitchTime", "10", o -> validateInt(1, 60 * 60, (Integer) o));
- loadProperty("cinemaModeZoomMultiplier", "100", o -> validateInt(1, 1000, (Integer) o));
-
- loadProperty("alertLocal", "true");
- loadProperty("alertLocalDist", "200", o -> validateDouble(0, 30000, (Double) o));
- loadProperty("alertRegion", "true");
- loadProperty("alertRegionMag", "3.5", o -> validateDouble(0, 10, (Double) o));
- loadProperty("alertRegionDist", "1000", o -> validateDouble(0, 30000, (Double) o));
- loadProperty("alertGlobal", "true");
- loadProperty("alertGlobalMag", "6.0", o -> validateDouble(0, 10, (Double) o));
-
- loadProperty("reportsEnabled", "false");
- loadProperty("displayClusters", "false");
- loadProperty("selectedDateFormatIndex", "0", o -> validateInt(0, DATE_FORMATS.length - 1, (Integer) o));
- loadProperty("stationIntensityVisibilityZoomLevel", "0.2", o -> validateDouble(0, 10, (Double) o));
- loadProperty("use24HFormat", "true");
- loadProperty("hideDeadStations", "false");
- loadProperty("stationsTriangles", "false");
- loadProperty("maxArchivedQuakes", "100", o -> validateInt(1, Integer.MAX_VALUE, (Integer) o));
-
- loadProperty("enableAlarmDialogs", "false");
- loadProperty("homeLat", "0.0", o -> validateDouble(-90, 90, (Double) o));
- loadProperty("homeLon", "0.0", o -> validateDouble(-180, 180, (Double) o));
- loadProperty("displayArchivedQuakes", "true");
- loadProperty("enableSound", "true");
- loadProperty("pWaveInaccuracyThreshold", String.valueOf(pWaveInaccuracyThresholdDefault));
- loadProperty("hypocenterCorrectThreshold", String.valueOf(hypocenterCorrectThresholdDefault));
- loadProperty("hypocenterDetectionResolution", String.valueOf(hypocenterDetectionResolutionDefault));
- loadProperty("minimumStationsForEEW", String.valueOf(minimumStationsForEEWDefault));
- loadProperty("useOldColorScheme", "false");
- loadProperty("parallelHypocenterLocations", "true");
- loadProperty("displayHomeLocation", "true");
- loadProperty("antialiasing", "false");
- loadProperty("fpsIdle", "30", o -> validateInt(1, 300, (Integer) o));
- loadProperty("intensityScaleIndex", "0", o -> validateInt(0, IntensityScales.INTENSITY_SCALES.length - 1, (Integer) o));
- loadProperty("oldEventsTimeFilterEnabled", "false");
- loadProperty("oldEventsTimeFilter", "24.0", o -> validateDouble(0, 24 * 365, (Double) o));
- loadProperty("oldEventsMagnitudeFilterEnabled", "false");
- loadProperty("oldEventsMagnitudeFilter", "4.0", o -> validateDouble(0, 10, (Double) o));
- loadProperty("oldEventsOpacity", "100.0", o -> validateDouble(0, 100, (Double) o));
-
- save();
- }
-
-
- public static String formatDateTime(TemporalAccessor temporalAccessor) {
- return selectedDateTimeFormat().format(temporalAccessor) +
- " " +
- (use24HFormat ? formatter24H : formatter12H).format(temporalAccessor);
- }
-
- private static DateTimeFormatter selectedDateTimeFormat(){
- int i = Math.max(0, Math.min(DATE_FORMATS.length - 1, selectedDateFormatIndex));
- return DATE_FORMATS[i];
- }
-
- public static DistanceUnit getSelectedDistanceUnit(){
- return DistanceUnit.values()[Math.max(0, Math.min(DistanceUnit.values().length - 1, distanceUnitsIndex))];
- }
-
- public static boolean validateDouble(double min, double max, double v){
- return !Double.isInfinite(v) && !Double.isNaN(v) && !(v < min) && !(v > max);
- }
-
- public static boolean validateInt(int min, int max, int v){
- return !(v < min) && !(v > max);
- }
-
- private static void setProperty(Field field, Object value) {
- try {
- field.set(null, value);
- } catch (Exception e) {
- Logger.error(e);
- }
- }
-
- private static void loadProperty(String name, String defaultVal){
- loadProperty(name, defaultVal, null);
- }
-
- private static void loadProperty(String name, String defaultVal, Function