From e6fa60e2874302fcaa748f2df943dc8cf4d2832d Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 10 Jun 2024 21:53:23 +0200 Subject: [PATCH] Add SubsystemMainClass --- .../staropensource/sosengine/base/Engine.java | 3 +- .../base/classes/SubsystemMainClass.java | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java diff --git a/base/src/main/java/de/staropensource/sosengine/base/Engine.java b/base/src/main/java/de/staropensource/sosengine/base/Engine.java index be7c9b2..d55f4cc 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/Engine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/Engine.java @@ -19,6 +19,7 @@ package de.staropensource.sosengine.base; +import de.staropensource.sosengine.base.classes.SubsystemMainClass; import de.staropensource.sosengine.base.data.info.EngineInformation; import de.staropensource.sosengine.base.events.EngineShutdownEvent; import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent; @@ -42,7 +43,7 @@ import java.util.Map; * @since 1-alpha0 */ @SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) -public final class Engine { +public final class Engine implements SubsystemMainClass { /** * Instance. * diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java b/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java new file mode 100644 index 0000000..b658b48 --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java @@ -0,0 +1,51 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.classes; + +import de.staropensource.sosengine.base.Engine; +import de.staropensource.sosengine.base.annotations.EventListener; +import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent; +import de.staropensource.sosengine.base.logging.LoggerInstance; + +/** + * The interface for engine subsystem main classes. + * + * @since 1-alpha0 + */ +@SuppressWarnings({ "unused" }) +public interface SubsystemMainClass { + /** + * Logger instance. + * + * @see LoggerInstance + * @since 1-alpha0 + */ + LoggerInstance logger = null; + + /** + * Called when the engine shuts down. + * + * @see Engine#shutdown() + * @see Engine#shutdown(int) + * @since 1-alpha0 + */ + @EventListener(event = InternalEngineShutdownEvent.class) + static void shutdown() {} +}