diff --git a/server/src/main/java/xyz/e3ndr/athena/Launcher.java b/server/src/main/java/xyz/e3ndr/athena/Launcher.java index 49ff366..c085402 100644 --- a/server/src/main/java/xyz/e3ndr/athena/Launcher.java +++ b/server/src/main/java/xyz/e3ndr/athena/Launcher.java @@ -7,9 +7,9 @@ import co.casterlabs.rakurai.json.Rson; import co.casterlabs.rakurai.json.serialization.JsonParseException; import co.casterlabs.sora.SoraFramework; -import xyz.e3ndr.athena.server.ftp.AthenaFtpServer; -import xyz.e3ndr.athena.server.http.AthenaHttpServer; -import xyz.e3ndr.athena.webui.AthenaUIServer; +import xyz.e3ndr.athena.service.ftp.AthenaFtpServer; +import xyz.e3ndr.athena.service.http.AthenaHttpServer; +import xyz.e3ndr.athena.service.simple_ui.AthenaSimpleUIServer; import xyz.e3ndr.fastloggingframework.FastLoggingFramework; import xyz.e3ndr.fastloggingframework.logging.FastLogger; import xyz.e3ndr.fastloggingframework.logging.LogLevel; @@ -48,15 +48,15 @@ public static void main(String[] args) throws Exception { // Go! if (Athena.config.services.http.enable) { - AsyncTask.createNonDaemon(() -> new AthenaHttpServer().start()); + AsyncTask.createNonDaemon(() -> new AthenaHttpServer().init()); } if (Athena.config.services.http.enable) { - AsyncTask.createNonDaemon(() -> new AthenaFtpServer().start()); + AsyncTask.createNonDaemon(() -> new AthenaFtpServer().init()); } if (Athena.config.services.simpleUI.enable) { - AsyncTask.createNonDaemon(() -> new AthenaUIServer().start()); + AsyncTask.createNonDaemon(() -> new AthenaSimpleUIServer().init()); } } diff --git a/server/src/main/java/xyz/e3ndr/athena/server/AthenaServer.java b/server/src/main/java/xyz/e3ndr/athena/server/AthenaServer.java deleted file mode 100644 index 360ff60..0000000 --- a/server/src/main/java/xyz/e3ndr/athena/server/AthenaServer.java +++ /dev/null @@ -1,7 +0,0 @@ -package xyz.e3ndr.athena.server; - -public interface AthenaServer { - - public void start(); - -} diff --git a/server/src/main/java/xyz/e3ndr/athena/service/AthenaService.java b/server/src/main/java/xyz/e3ndr/athena/service/AthenaService.java new file mode 100644 index 0000000..1c4f7d2 --- /dev/null +++ b/server/src/main/java/xyz/e3ndr/athena/service/AthenaService.java @@ -0,0 +1,7 @@ +package xyz.e3ndr.athena.service; + +public interface AthenaService { + + public void init(); + +} diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/HTMLBuilder.java b/server/src/main/java/xyz/e3ndr/athena/service/HTMLBuilder.java similarity index 98% rename from server/src/main/java/xyz/e3ndr/athena/webui/HTMLBuilder.java rename to server/src/main/java/xyz/e3ndr/athena/service/HTMLBuilder.java index 2eb0f86..3fa0c2d 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/HTMLBuilder.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/HTMLBuilder.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.webui; +package xyz.e3ndr.athena.service; import java.util.Arrays; import java.util.LinkedList; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/ftp/AthenaFtpServer.java b/server/src/main/java/xyz/e3ndr/athena/service/ftp/AthenaFtpServer.java similarity index 91% rename from server/src/main/java/xyz/e3ndr/athena/server/ftp/AthenaFtpServer.java rename to server/src/main/java/xyz/e3ndr/athena/service/ftp/AthenaFtpServer.java index 2fa07fe..d1060d2 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/ftp/AthenaFtpServer.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/ftp/AthenaFtpServer.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.ftp; +package xyz.e3ndr.athena.service.ftp; import java.io.IOException; import java.net.ServerSocket; @@ -8,7 +8,7 @@ import java.util.List; import xyz.e3ndr.athena.Athena; -import xyz.e3ndr.athena.server.AthenaServer; +import xyz.e3ndr.athena.service.AthenaService; import xyz.e3ndr.fastloggingframework.logging.FastLogger; import xyz.e3ndr.fastloggingframework.logging.LogLevel; @@ -17,14 +17,14 @@ * * @author Moritz Stueckler */ -public class AthenaFtpServer implements AthenaServer { +public class AthenaFtpServer implements AthenaService { private static final int MAX_CLIENTS = 100; private static final int FTP_PORT_RANGE_OFFSET = 100; static final List openPorts = Collections.synchronizedList(new LinkedList<>()); @SuppressWarnings("resource") @Override - public void start() { + public void init() { int controlPort = Athena.config.services.ftp.port; // Generate a list of ports. diff --git a/server/src/main/java/xyz/e3ndr/athena/server/ftp/FtpClient.java b/server/src/main/java/xyz/e3ndr/athena/service/ftp/FtpClient.java similarity index 99% rename from server/src/main/java/xyz/e3ndr/athena/server/ftp/FtpClient.java rename to server/src/main/java/xyz/e3ndr/athena/service/ftp/FtpClient.java index eab6c72..d6759c4 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/ftp/FtpClient.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/ftp/FtpClient.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.ftp; +package xyz.e3ndr.athena.service.ftp; import java.io.BufferedReader; import java.io.Closeable; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/ftp/LoginState.java b/server/src/main/java/xyz/e3ndr/athena/service/ftp/LoginState.java similarity index 68% rename from server/src/main/java/xyz/e3ndr/athena/server/ftp/LoginState.java rename to server/src/main/java/xyz/e3ndr/athena/service/ftp/LoginState.java index 68740cd..92b0e19 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/ftp/LoginState.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/ftp/LoginState.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.ftp; +package xyz.e3ndr.athena.service.ftp; enum LoginState { WAITING_FOR_USERNAME, diff --git a/server/src/main/java/xyz/e3ndr/athena/server/ftp/TransferType.java b/server/src/main/java/xyz/e3ndr/athena/service/ftp/TransferType.java similarity index 54% rename from server/src/main/java/xyz/e3ndr/athena/server/ftp/TransferType.java rename to server/src/main/java/xyz/e3ndr/athena/service/ftp/TransferType.java index 1f97904..b12fb71 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/ftp/TransferType.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/ftp/TransferType.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.ftp; +package xyz.e3ndr.athena.service.ftp; enum TransferType { ASCII, diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/AthenaHttpServer.java b/server/src/main/java/xyz/e3ndr/athena/service/http/AthenaHttpServer.java similarity index 92% rename from server/src/main/java/xyz/e3ndr/athena/server/http/AthenaHttpServer.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/AthenaHttpServer.java index 2205875..e97fda9 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/AthenaHttpServer.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/AthenaHttpServer.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import org.jetbrains.annotations.Nullable; @@ -8,14 +8,14 @@ import co.casterlabs.sora.api.SoraPlugin; import lombok.NonNull; import xyz.e3ndr.athena.Athena; -import xyz.e3ndr.athena.server.AthenaServer; +import xyz.e3ndr.athena.service.AthenaService; import xyz.e3ndr.fastloggingframework.logging.FastLogger; import xyz.e3ndr.fastloggingframework.logging.LogLevel; -public class AthenaHttpServer implements AthenaServer { +public class AthenaHttpServer implements AthenaService { @Override - public void start() { + public void init() { try { int port = Athena.config.services.http.port; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/IngestApiRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/IngestApiRoutes.java similarity index 99% rename from server/src/main/java/xyz/e3ndr/athena/server/http/IngestApiRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/IngestApiRoutes.java index db4b401..2abe372 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/IngestApiRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/IngestApiRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.io.IOException; import java.io.OutputStream; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/JsonResponse.java b/server/src/main/java/xyz/e3ndr/athena/service/http/JsonResponse.java similarity index 97% rename from server/src/main/java/xyz/e3ndr/athena/server/http/JsonResponse.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/JsonResponse.java index 6493f86..c651552 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/JsonResponse.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/JsonResponse.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.nio.charset.StandardCharsets; import java.util.Map; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/MediaRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/MediaRoutes.java similarity index 98% rename from server/src/main/java/xyz/e3ndr/athena/server/http/MediaRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/MediaRoutes.java index 48e8ced..ba9a42e 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/MediaRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/MediaRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.util.Arrays; import java.util.Map; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/MetaRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/MetaRoutes.java similarity index 97% rename from server/src/main/java/xyz/e3ndr/athena/server/http/MetaRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/MetaRoutes.java index d9d7637..354fd51 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/MetaRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/MetaRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import co.casterlabs.rakurai.io.http.StandardHttpStatus; import co.casterlabs.rakurai.io.http.server.HttpResponse; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/SessionRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/SessionRoutes.java similarity index 97% rename from server/src/main/java/xyz/e3ndr/athena/server/http/SessionRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/SessionRoutes.java index 3e877d2..cf916d6 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/SessionRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/SessionRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.util.Arrays; import java.util.Map; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/StreamRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/StreamRoutes.java similarity index 99% rename from server/src/main/java/xyz/e3ndr/athena/server/http/StreamRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/StreamRoutes.java index 78c5307..b829a9a 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/StreamRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/StreamRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.io.File; import java.io.IOException; diff --git a/server/src/main/java/xyz/e3ndr/athena/server/http/WiiMCRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/http/WiiMCRoutes.java similarity index 98% rename from server/src/main/java/xyz/e3ndr/athena/server/http/WiiMCRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/http/WiiMCRoutes.java index c475753..3618eea 100644 --- a/server/src/main/java/xyz/e3ndr/athena/server/http/WiiMCRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/http/WiiMCRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.server.http; +package xyz.e3ndr.athena.service.http; import java.util.List; diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/AthenaSimpleUIServer.java similarity index 91% rename from server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java rename to server/src/main/java/xyz/e3ndr/athena/service/simple_ui/AthenaSimpleUIServer.java index c566c93..45d6da0 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/AthenaSimpleUIServer.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.webui; +package xyz.e3ndr.athena.service.simple_ui; import org.jetbrains.annotations.Nullable; @@ -8,14 +8,14 @@ import co.casterlabs.sora.api.SoraPlugin; import lombok.NonNull; import xyz.e3ndr.athena.Athena; -import xyz.e3ndr.athena.server.AthenaServer; +import xyz.e3ndr.athena.service.AthenaService; import xyz.e3ndr.fastloggingframework.logging.FastLogger; import xyz.e3ndr.fastloggingframework.logging.LogLevel; -public class AthenaUIServer implements AthenaServer { +public class AthenaSimpleUIServer implements AthenaService { @Override - public void start() { + public void init() { try { int port = Athena.config.services.simpleUI.port; diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/InternalRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/InternalRoutes.java similarity index 88% rename from server/src/main/java/xyz/e3ndr/athena/webui/InternalRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/simple_ui/InternalRoutes.java index 243d362..8a97a53 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/InternalRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/InternalRoutes.java @@ -1,10 +1,10 @@ -package xyz.e3ndr.athena.webui; +package xyz.e3ndr.athena.service.simple_ui; import co.casterlabs.rakurai.io.http.server.HttpResponse; import co.casterlabs.sora.api.http.HttpProvider; import co.casterlabs.sora.api.http.SoraHttpSession; import co.casterlabs.sora.api.http.annotations.HttpEndpoint; -import xyz.e3ndr.athena.server.http.StreamRoutes; +import xyz.e3ndr.athena.service.http.StreamRoutes; class InternalRoutes implements HttpProvider { private StreamRoutes streamRoutes = new StreamRoutes(); diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/UIRoutes.java similarity index 99% rename from server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java rename to server/src/main/java/xyz/e3ndr/athena/service/simple_ui/UIRoutes.java index 2d7ae06..194df84 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java +++ b/server/src/main/java/xyz/e3ndr/athena/service/simple_ui/UIRoutes.java @@ -1,4 +1,4 @@ -package xyz.e3ndr.athena.webui; +package xyz.e3ndr.athena.service.simple_ui; import java.net.HttpURLConnection; import java.net.URL; @@ -24,6 +24,7 @@ import co.casterlabs.sora.api.http.annotations.HttpEndpoint; import lombok.SneakyThrows; import xyz.e3ndr.athena.Athena; +import xyz.e3ndr.athena.service.HTMLBuilder; import xyz.e3ndr.athena.types.AudioCodec; import xyz.e3ndr.athena.types.ContainerFormat; import xyz.e3ndr.athena.types.VideoCodec;