From 3d3f21e2173a50e479881535610c10dc47ebde6b Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 21 Sep 2024 17:24:27 +0200 Subject: [PATCH] Rename setting 'optimizeSubsystemInitialization' --- .../staropensource/sosengine/base/Engine.java | 2 +- .../sosengine/base/EngineConfiguration.java | 52 +++++++++++-------- 2 files changed, 30 insertions(+), 24 deletions(-) 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 a36ebcf0..44710042 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/Engine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/Engine.java @@ -210,7 +210,7 @@ public final class Engine extends SubsystemClass { state = EngineState.STARTUP; // Perform automatic subsystem initialization - if (EngineConfiguration.getInstance().isOptimizeSubsystemInitialization()) { + if (EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization()) { collectSubsystems(); // Collect subsystems // Initialize subsystems diff --git a/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java b/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java index 9c09b83d..736afd85 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java +++ b/base/src/main/java/de/staropensource/sosengine/base/EngineConfiguration.java @@ -81,6 +81,7 @@ public final class EngineConfiguration extends Configuration { */ private final @NotNull String group = "sosengine.base."; + /** * If enabled, allows for unintentional behaviour * and excess logging. Unless you want to debug or work @@ -124,6 +125,28 @@ public final class EngineConfiguration extends Configuration { */ private boolean debugShortcodeConverter; + + /** + * If enabled, will try to automatically initialize every + * subsystem found though reflection. + *

+ * This however may fail in certain situation, where manual + * subsystem initialization may be required. For this reason, + * this can be turned off before the engine initializes. Please + * note though that dependency resolution between subsystems + * won't be performed, be careful when initializing subsystems manually. + * + * @see Engine + * @since v1-alpha2 + * -- GETTER -- + * Gets the value for {@link #initialPerformSubsystemInitialization}. + * + * @return variable value + * @see #initialPerformSubsystemInitialization + * @since v1-alpha2 + */ + private boolean initialPerformSubsystemInitialization; + /** * If enabled, will force-disable reflective classpath scanning. * @@ -153,6 +176,7 @@ public final class EngineConfiguration extends Configuration { */ private Set<@NotNull String> initialIncludeSubsystemClasses; + /** * If enabled, invalid shortcodes will be logged by the {@link ShortcodeParser}. * The message will be printed as a {@link LogLevel#SILENT_WARNING}. @@ -169,6 +193,7 @@ public final class EngineConfiguration extends Configuration { */ private boolean errorShortcodeConverter; + /** * If enabled, will makes the {@link Logger} work asynchronous, * in a separate platform thread. Don't disable unless you want @@ -202,26 +227,6 @@ public final class EngineConfiguration extends Configuration { */ private boolean optimizeEvents; - /** - * If enabled, will try to automatically initialize every - * subsystem found though reflection. - *

- * This however may fail in certain situation, where manual - * subsystem initialization may be required. For this reason, - * this can be turned off before the engine initializes. Please - * note though that dependency resolution between subsystems - * won't be performed, be careful when initializing subsystems manually. - * - * @see Engine - * @since v1-alpha2 - * -- GETTER -- - * Gets the value for {@link #optimizeSubsystemInitialization}. - * - * @return variable value - * @see #optimizeSubsystemInitialization - * @since v1-alpha2 - */ - private boolean optimizeSubsystemInitialization; /** * Contains which logger levels are allowed @@ -327,6 +332,7 @@ public final class EngineConfiguration extends Configuration { */ private boolean loggerImmediateShutdown; + /** * Will truncate the path of types when using * their {@code toString} method. @@ -379,6 +385,7 @@ public final class EngineConfiguration extends Configuration { case "debugEvents" -> debugEvents = parser.getBoolean(group + property); case "debugShortcodeConverter" -> debugShortcodeConverter = parser.getBoolean(group + property); + case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property); case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning = parser.getBoolean(group + property); case "initialIncludeSubsystemClasses" -> { initialIncludeSubsystemClasses = new HashSet<>(); @@ -395,7 +402,6 @@ public final class EngineConfiguration extends Configuration { LoggingThread.startThread(); } case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property); - case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization = parser.getBoolean(group + property); case "loggerLevel" -> { try { @@ -432,6 +438,7 @@ public final class EngineConfiguration extends Configuration { debugEvents = false; debugShortcodeConverter = false; + initialPerformSubsystemInitialization = true; initialForceDisableClasspathScanning = false; initialIncludeSubsystemClasses = new HashSet<>(); @@ -439,7 +446,6 @@ public final class EngineConfiguration extends Configuration { optimizeLogging = true; optimizeEvents = true; - optimizeSubsystemInitialization = true; loggerLevel = LogLevel.INFORMATIONAL; loggerTemplate = "%log_color_primary%[%time_hour%:%time_minute%:%time_second%] [%log_level% %log_path%%log_metadata%] %log_message_prefix%%log_color_primary%%log_color_secondary%%log_message%"; @@ -459,6 +465,7 @@ public final class EngineConfiguration extends Configuration { case "debugEvents" -> debugEvents; case "debugShortcodeConverter" -> debugShortcodeConverter; + case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization; case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning; case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses; @@ -466,7 +473,6 @@ public final class EngineConfiguration extends Configuration { case "optimizeLogging" -> optimizeLogging; case "optimizeEvents" -> optimizeEvents; - case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization; case "loggerLevel" -> loggerLevel; case "loggerTemplate" -> loggerTemplate;