MASSIVE CODE CHANGE
tl;dr I changed many Javadoc comments, some code, removed dumb or unused stuff and revamped the entire logging infrastructure by yeeting out LogIssuer and CodePart and much, much more
This commit is contained in:
parent
5be690fd38
commit
f383261ed9
239 changed files with 2867 additions and 2497 deletions
|
@ -20,50 +20,46 @@
|
||||||
package de.staropensource.sosengine.ansi;
|
package de.staropensource.sosengine.ansi;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||||
import de.staropensource.sosengine.base.classes.LoggerImpl;
|
import de.staropensource.sosengine.base.classes.LoggerImplementation;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
||||||
import org.fusesource.jansi.Ansi;
|
import org.fusesource.jansi.Ansi;
|
||||||
import org.fusesource.jansi.AnsiConsole;
|
import org.fusesource.jansi.AnsiConsole;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses and prints colored log output using the Jansi library.
|
* Prints colored log output using the Jansi library.
|
||||||
*
|
*
|
||||||
* @see Logger
|
* @see Logger
|
||||||
* @see LoggerImpl
|
* @see LoggerImplementation
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public class AnsiLoggerImpl implements LoggerImpl {
|
public class AnsiLoggerImplementation implements LoggerImplementation {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public AnsiLoggerImpl() {}
|
public AnsiLoggerImplementation() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String prePlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
|
public @NotNull String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
|
||||||
// No modifications necessary
|
return format; // No modifications necessary
|
||||||
return message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
|
public @NotNull String postPlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
|
||||||
// No modifications necessary
|
return format; // No modifications necessary
|
||||||
return format;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here
|
@SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here
|
||||||
@Override
|
@Override
|
||||||
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
|
public void print(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
|
||||||
// Convert to Ansi
|
// Convert to Ansi
|
||||||
Ansi output = new AnsiShortcodeConverter(format, true).getAnsi();
|
Ansi output = new AnsiShortcodeConverter(format, true).getAnsi();
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
* Converts shortcodes such as {@code <bold>} or {@code <blink>} into a usable {@link Ansi} escape sequence.
|
* Converts shortcodes such as {@code <bold>} or {@code <blink>} into a usable {@link Ansi} escape sequence.
|
||||||
*
|
*
|
||||||
* @see ShortcodeParserSkeleton
|
* @see ShortcodeParserSkeleton
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class AnsiShortcodeConverter extends ShortcodeParserSkeleton {
|
public final class AnsiShortcodeConverter extends ShortcodeParserSkeleton {
|
||||||
|
@ -38,7 +38,7 @@ public final class AnsiShortcodeConverter extends ShortcodeParserSkeleton {
|
||||||
* @param string string to convert
|
* @param string string to convert
|
||||||
* @param ignoreInvalidEscapes will ignore invalid escapes and print treat them like regular text
|
* @param ignoreInvalidEscapes will ignore invalid escapes and print treat them like regular text
|
||||||
* @throws ParserException when parsing failed
|
* @throws ParserException when parsing failed
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public AnsiShortcodeConverter(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
public AnsiShortcodeConverter(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
||||||
super(string, ignoreInvalidEscapes);
|
super(string, ignoreInvalidEscapes);
|
||||||
|
@ -48,10 +48,9 @@ public final class AnsiShortcodeConverter extends ShortcodeParserSkeleton {
|
||||||
* Returns the parsed string as an {@link Ansi} sequence.
|
* Returns the parsed string as an {@link Ansi} sequence.
|
||||||
*
|
*
|
||||||
* @return {@link Ansi} sequence
|
* @return {@link Ansi} sequence
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public @NotNull Ansi getAnsi() {
|
||||||
public Ansi getAnsi() {
|
|
||||||
Ansi ansi = Ansi.ansi();
|
Ansi ansi = Ansi.ansi();
|
||||||
|
|
||||||
for (String component : components)
|
for (String component : components)
|
||||||
|
|
|
@ -20,71 +20,63 @@
|
||||||
package de.staropensource.sosengine.ansi;
|
package de.staropensource.sosengine.ansi;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemClass;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.DependencyVector;
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main object for the ANSI Compatibility subsystem.
|
* Main object for the ANSI Compatibility subsystem.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@EngineSubsystem
|
@EngineSubsystem
|
||||||
public final class AnsiSubsystem implements SubsystemMainClass {
|
public final class AnsiSubsystem extends SubsystemClass {
|
||||||
/**
|
/**
|
||||||
* Contains the class instance.
|
* Contains the class instance.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the class instance.
|
* Returns the class instance.
|
||||||
*
|
*
|
||||||
* @return class instance unless the subsystem is uninitialized
|
* @return class instance unless the subsystem is uninitialized
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private static AnsiSubsystem instance = null;
|
private static AnsiSubsystem instance = null;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
private final LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this subsystem.
|
* Constructs this subsystem.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public AnsiSubsystem() {
|
public AnsiSubsystem() {
|
||||||
// Check if subsystem has already initialized
|
// Check if subsystem has already initialized
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = this;
|
instance = this;
|
||||||
else {
|
else
|
||||||
instance.logger.crash("The subsystem tried to initialize twice");
|
logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "ansi";
|
return "ansi";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void initializeSubsystem() {
|
public void initializeSubsystem() {
|
||||||
Logger.setLoggerImplementation(new AnsiLoggerImpl());
|
Logger.setLoggerImplementation(new AnsiLoggerImplementation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public DependencyVector getDependencyVector() {
|
public @NotNull DependencyVector getDependencyVector() {
|
||||||
return new DependencyVector("ansi", StarOpenSourceVersioningSystem.class, EngineInformation.getVersioningString());
|
return new DependencyVector("ansi", StarOpenSourceVersioningSystem.class, EngineInformation.getVersioningString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Defines the ANSI subsystem, allowing the engine to
|
* The ANSI subsystem, allowing the engine to
|
||||||
* use ANSI escape codes using the Jansi library.
|
* use ANSI escape codes using the Jansi library.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
package de.staropensource.sosengine.base;
|
package de.staropensource.sosengine.base;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemClass;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.events.*;
|
import de.staropensource.sosengine.base.events.*;
|
||||||
import de.staropensource.sosengine.base.exceptions.dependency.UnmetDependenciesException;
|
import de.staropensource.sosengine.base.exceptions.dependency.UnmetDependenciesException;
|
||||||
|
@ -31,10 +31,8 @@ import de.staropensource.sosengine.base.internal.types.DependencySubsystemVector
|
||||||
import de.staropensource.sosengine.base.logging.CrashHandler;
|
import de.staropensource.sosengine.base.logging.CrashHandler;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.DependencyVector;
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.types.immutable.ImmutableLinkedList;
|
import de.staropensource.sosengine.base.types.immutable.ImmutableLinkedList;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
||||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
||||||
|
@ -49,24 +47,22 @@ import org.reflections.util.ConfigurationBuilder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sos!engine management object.<br/>
|
* Main class of the sos!engine.
|
||||||
* It is responsible for the base engine initialization.
|
|
||||||
*
|
*
|
||||||
* @see EngineConfiguration
|
* @see EngineConfiguration
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@EngineSubsystem
|
@EngineSubsystem
|
||||||
public final class Engine implements SubsystemMainClass {
|
public final class Engine extends SubsystemClass {
|
||||||
/**
|
/**
|
||||||
* Contains the class instance.
|
* Contains the class instance.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the class instance.
|
* Returns the class instance.
|
||||||
*
|
*
|
||||||
* @return class instance unless the engine is uninitialized
|
* @return class instance unless {@link Engine} is uninitialized
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -76,7 +72,6 @@ public final class Engine implements SubsystemMainClass {
|
||||||
* Contains the thread group of the engine.
|
* Contains the thread group of the engine.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the thread group of the engine.
|
* Returns the thread group of the engine.
|
||||||
*
|
*
|
||||||
|
@ -87,19 +82,18 @@ public final class Engine implements SubsystemMainClass {
|
||||||
private static final ThreadGroup threadGroup = new ThreadGroup("sos!engine");
|
private static final ThreadGroup threadGroup = new ThreadGroup("sos!engine");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger instance.
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
*
|
*
|
||||||
* @see LoggerInstance
|
* @see LoggerInstance
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
private LoggerInstance logger;
|
private static LoggerInstance logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a list of all registered subsystems.
|
* Contains a list of all registered subsystems.
|
||||||
* The list is sorted after initialization order.
|
* The list is sorted after initialization order.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns a list of all registered subsystems.
|
* Returns a list of all registered subsystems.
|
||||||
* The list is sorted after initialization order.
|
* The list is sorted after initialization order.
|
||||||
|
@ -107,19 +101,17 @@ public final class Engine implements SubsystemMainClass {
|
||||||
* @return subsystem list
|
* @return subsystem list
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
@Getter
|
@Getter
|
||||||
private ImmutableLinkedList<@NotNull DependencySubsystemVector> subsystems = new ImmutableLinkedList<>();
|
private @NotNull ImmutableLinkedList<@NotNull DependencySubsystemVector> subsystems = new ImmutableLinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the engine is shutting down.
|
* Contains if the engine is shutting down.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns if the engine is shutting down.
|
* Returns if the engine is shutting down.
|
||||||
*
|
*
|
||||||
* @return if the engine is shutting down
|
* @return shutdown status
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -138,18 +130,18 @@ public final class Engine implements SubsystemMainClass {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long initTime = Miscellaneous.measureExecutionTime(() -> {
|
long initTime = Miscellaneous.measureExecutionTime(() -> {
|
||||||
// Initialize variables
|
// Initialize engine configuration
|
||||||
logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
|
||||||
|
|
||||||
// Initialize EngineConfiguration and load it
|
|
||||||
new EngineConfiguration();
|
new EngineConfiguration();
|
||||||
EngineConfiguration.getInstance().loadConfiguration();
|
EngineConfiguration.getInstance().loadConfiguration();
|
||||||
|
|
||||||
initializeClasses(); // Initialize classes
|
initializeClasses(); // Initialize classes
|
||||||
populateCrashContent(); // Populate crash content
|
populateCrashContent(); // Populate crash content
|
||||||
precomputeEventListeners(); // Precompute event listeners
|
cacheEvents(); // Cache event listeners
|
||||||
startThreads(); // Start threads
|
startThreads(); // Start threads
|
||||||
|
|
||||||
|
// Set the logger instance
|
||||||
|
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").setMetadata(EngineInformation.getVersioningCodename()).build();
|
||||||
|
|
||||||
// Perform automatic subsystem initialization
|
// Perform automatic subsystem initialization
|
||||||
if (EngineConfiguration.getInstance().isOptimizeSubsystemInitialization()) {
|
if (EngineConfiguration.getInstance().isOptimizeSubsystemInitialization()) {
|
||||||
collectSubsystems(); // Collect subsystems
|
collectSubsystems(); // Collect subsystems
|
||||||
|
@ -172,14 +164,13 @@ public final class Engine implements SubsystemMainClass {
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
private void initializeClasses() {
|
private void initializeClasses() {
|
||||||
// Sorted in rough order of dependence
|
|
||||||
new PlaceholderEngine();
|
new PlaceholderEngine();
|
||||||
|
|
||||||
EngineInformation.updateVariables();
|
EngineInformation.updateVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method populates the Crash Handler's content with the default set of content.
|
* This method populates {@link CrashHandler#crashContent} with content.
|
||||||
*
|
*
|
||||||
* @see CrashHandler#getCrashContent()
|
* @see CrashHandler#getCrashContent()
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -188,10 +179,10 @@ public final class Engine implements SubsystemMainClass {
|
||||||
private void populateCrashContent() {
|
private void populateCrashContent() {
|
||||||
// Issuer
|
// Issuer
|
||||||
Map<@NotNull String, @NotNull String> crashContentIssuer = new LinkedHashMap<>();
|
Map<@NotNull String, @NotNull String> crashContentIssuer = new LinkedHashMap<>();
|
||||||
crashContentIssuer.put("Code part", "%issuer_code_part%");
|
crashContentIssuer.put("Code part", "%issuer_origin%");
|
||||||
crashContentIssuer.put("Classpath", "%issuer_path%");
|
crashContentIssuer.put("Classpath", "%issuer_path%");
|
||||||
crashContentIssuer.put("Additional information", "%issuer_info%");
|
crashContentIssuer.put("Additional information", "%issuer_metadata%");
|
||||||
crashContentIssuer.put("Message", "%issuer_message%");
|
crashContentIssuer.put("Message", "%crash_message%");
|
||||||
|
|
||||||
// Engine -> Dependencies -> base
|
// Engine -> Dependencies -> base
|
||||||
Map<@NotNull String, @NotNull String> crashContentEngineDependenciesBase = new LinkedHashMap<>();
|
Map<@NotNull String, @NotNull String> crashContentEngineDependenciesBase = new LinkedHashMap<>();
|
||||||
|
@ -241,20 +232,20 @@ public final class Engine implements SubsystemMainClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Precomputes all base engine events.
|
* Caches all base engine events.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
private void precomputeEventListeners() {
|
private void cacheEvents() {
|
||||||
// Internal events
|
// Internal events
|
||||||
EventHelper.precomputeEventListeners(InternalEngineShutdownEvent.class);
|
EventHelper.cacheEvent(InternalEngineShutdownEvent.class);
|
||||||
|
|
||||||
// General events
|
// General events
|
||||||
EventHelper.precomputeEventListeners(EngineCrashEvent.class);
|
EventHelper.cacheEvent(EngineCrashEvent.class);
|
||||||
EventHelper.precomputeEventListeners(EngineShutdownEvent.class);
|
EventHelper.cacheEvent(EngineShutdownEvent.class);
|
||||||
EventHelper.precomputeEventListeners(EngineSoftCrashEvent.class);
|
EventHelper.cacheEvent(EngineSoftCrashEvent.class);
|
||||||
EventHelper.precomputeEventListeners(LogEvent.class);
|
EventHelper.cacheEvent(LogEvent.class);
|
||||||
EventHelper.precomputeEventListeners(ThrowableCatchEvent.class);
|
EventHelper.cacheEvent(ThrowableCatchEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,13 +271,13 @@ public final class Engine implements SubsystemMainClass {
|
||||||
try {
|
try {
|
||||||
// Create new instance
|
// Create new instance
|
||||||
Object initializedClassRaw = clazz.getDeclaredConstructor().newInstance();
|
Object initializedClassRaw = clazz.getDeclaredConstructor().newInstance();
|
||||||
SubsystemMainClass initializedClass = null;
|
SubsystemClass initializedClass = null;
|
||||||
|
|
||||||
// Check if class implements SubsystemMainClass
|
// Check if class implements SubsystemMainClass
|
||||||
if (initializedClassRaw instanceof SubsystemMainClass subsystemInstance)
|
if (initializedClassRaw instanceof SubsystemClass subsystemInstance)
|
||||||
initializedClass = subsystemInstance;
|
initializedClass = subsystemInstance;
|
||||||
else
|
else
|
||||||
logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Does not implement " + SubsystemMainClass.class.getName());
|
logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Does not implement " + SubsystemClass.class.getName());
|
||||||
|
|
||||||
//noinspection DataFlowIssue // the crash call will prevent a NullPointerException
|
//noinspection DataFlowIssue // the crash call will prevent a NullPointerException
|
||||||
subsystemsMutable.add(new DependencySubsystemVector(initializedClass.getDependencyVector(), initializedClass));
|
subsystemsMutable.add(new DependencySubsystemVector(initializedClass.getDependencyVector(), initializedClass));
|
||||||
|
@ -362,7 +353,7 @@ public final class Engine implements SubsystemMainClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts the engine and JVM down.
|
* Shuts the engine down.
|
||||||
*
|
*
|
||||||
* @param exitCode code to exit with, from 0-255
|
* @param exitCode code to exit with, from 0-255
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -396,20 +387,18 @@ public final class Engine implements SubsystemMainClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts the engine and JVM down.
|
* Shuts the engine down.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
shutdown(0);
|
if (instance != null)
|
||||||
|
instance.shutdown(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** {@inheritDoc} */
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "base";
|
return "base";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,9 +412,8 @@ public final class Engine implements SubsystemMainClass {
|
||||||
* @see DependencyVector
|
* @see DependencyVector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public DependencyVector getDependencyVector() {
|
public @NotNull DependencyVector getDependencyVector() {
|
||||||
return new DependencyVector("engine", StarOpenSourceVersioningSystem.class, EngineInformation.getVersioningString());
|
return new DependencyVector("engine", StarOpenSourceVersioningSystem.class, EngineInformation.getVersioningString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,12 @@
|
||||||
package de.staropensource.sosengine.base;
|
package de.staropensource.sosengine.base;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.ShortcodeParserSkeleton;
|
import de.staropensource.sosengine.base.classes.ShortcodeParserSkeleton;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemConfiguration;
|
import de.staropensource.sosengine.base.classes.Configuration;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.logging.CrashHandler;
|
import de.staropensource.sosengine.base.logging.CrashHandler;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
||||||
import de.staropensource.sosengine.base.types.vectors.Vec2;
|
import de.staropensource.sosengine.base.types.vectors.Vec2f;
|
||||||
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -42,7 +40,7 @@ import java.util.Properties;
|
||||||
* responsible for loading them into memory from {@link Properties} objects.
|
* responsible for loading them into memory from {@link Properties} objects.
|
||||||
* <p>
|
* <p>
|
||||||
* Now you might ask why we didn't go with the string-based approach.
|
* Now you might ask why we didn't go with the string-based approach.
|
||||||
* The answer is simple: It's a maintenance and documentation burden.
|
* The answer is simple: It's a maintenance burden.
|
||||||
* Having various settings strings scattered across many classes will cause
|
* Having various settings strings scattered across many classes will cause
|
||||||
* trouble at some point, which will cause some strings to be undocumented
|
* trouble at some point, which will cause some strings to be undocumented
|
||||||
* or have an inconsistent naming scheme. Containing settings as variables in
|
* or have an inconsistent naming scheme. Containing settings as variables in
|
||||||
|
@ -50,14 +48,13 @@ import java.util.Properties;
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class EngineConfiguration implements SubsystemConfiguration {
|
public final class EngineConfiguration extends Configuration {
|
||||||
/**
|
/**
|
||||||
* Contains the class instance.
|
* Contains the class instance.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the class instance.
|
* Returns the class instance.
|
||||||
*
|
*
|
||||||
|
@ -68,26 +65,23 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
private static EngineConfiguration instance;
|
private static EngineConfiguration instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the group every property must start with to be recognized as a subsystem configuration setting.
|
* Contains the group in which setting overrides must begin with..
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the group that every property must start with to be recognized as a subsystem configuration setting.
|
* Returns the group in which setting overrides must begin with.
|
||||||
*
|
*
|
||||||
* @return property group
|
* @return property group
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final String group = "sosengine.base.";
|
private final @NotNull String group = "sosengine.base.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If enabled, allows for unintentional behaviour and excess logging.<br/>
|
* If enabled, allows for unintentional behaviour and excess logging.
|
||||||
* Unless you want to debug or work on a sensitive part of the engine, don't enable this!
|
* Unless you want to debug or work on a sensitive part of the engine, don't enable this!
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #debug}.
|
* Gets the value for {@link #debug}.
|
||||||
*
|
*
|
||||||
|
@ -102,7 +96,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
*
|
*
|
||||||
* @see EventHelper#logCall(Class, Object...)
|
* @see EventHelper#logCall(Class, Object...)
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #debugEvents}.
|
* Gets the value for {@link #debugEvents}.
|
||||||
*
|
*
|
||||||
|
@ -118,7 +111,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
*
|
*
|
||||||
* @see ShortcodeParserSkeleton
|
* @see ShortcodeParserSkeleton
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #debugShortcodeConverter}.
|
* Gets the value for {@link #debugShortcodeConverter}.
|
||||||
*
|
*
|
||||||
|
@ -135,7 +127,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
* @see ShortcodeParserSkeleton
|
* @see ShortcodeParserSkeleton
|
||||||
* @see #loggerLevel
|
* @see #loggerLevel
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #errorShortcodeConverter}.
|
* Gets the value for {@link #errorShortcodeConverter}.
|
||||||
*
|
*
|
||||||
|
@ -152,7 +143,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
* @see #loggerPollingSpeed
|
* @see #loggerPollingSpeed
|
||||||
* @see Thread
|
* @see Thread
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #optimizeLogging}.
|
* Gets the value for {@link #optimizeLogging}.
|
||||||
*
|
*
|
||||||
|
@ -168,7 +158,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
*
|
*
|
||||||
* @see VirtualThread
|
* @see VirtualThread
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #optimizeEvents}.
|
* Gets the value for {@link #optimizeEvents}.
|
||||||
*
|
*
|
||||||
|
@ -188,7 +177,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
*
|
*
|
||||||
* @see Engine
|
* @see Engine
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #optimizeSubsystemInitialization}.
|
* Gets the value for {@link #optimizeSubsystemInitialization}.
|
||||||
*
|
*
|
||||||
|
@ -199,11 +187,10 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
private boolean optimizeSubsystemInitialization;
|
private boolean optimizeSubsystemInitialization;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines which logger levels are allowed by setting the minimum logger level.
|
* Contains which logger levels are allowed by setting the minimum logger level.
|
||||||
*
|
*
|
||||||
* @see Logger
|
* @see Logger
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #loggerLevel}.
|
* Gets the value for {@link #loggerLevel}.
|
||||||
*
|
*
|
||||||
|
@ -218,7 +205,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
*
|
*
|
||||||
* @see Logger
|
* @see Logger
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #loggerTemplate}
|
* Gets the value for {@link #loggerTemplate}
|
||||||
*
|
*
|
||||||
|
@ -229,12 +215,11 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
private String loggerTemplate;
|
private String loggerTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If enabled, the JVM will immediately shutdown on an engine crash. This will prevent shutdown hooks from executing.<br/>
|
* If enabled, the JVM will immediately shutdown on an engine crash. This will prevent shutdown hooks from executing.
|
||||||
* Note: This will also prevent Jansi and potentially other libraries from removing temporary native libraries at shutdown.
|
* Note: This will also prevent Jansi and potentially other libraries from removing temporary native libraries at shutdown.
|
||||||
*
|
*
|
||||||
* @see CrashHandler
|
* @see CrashHandler
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #loggerImmediateShutdown}.
|
* Gets the value for {@link #loggerImmediateShutdown}.
|
||||||
*
|
*
|
||||||
|
@ -249,7 +234,6 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
* instead of <a href="https://www.man7.org/linux/man-pages/man3/stderr.3.html">the standard error</a> for logging {@code ERROR} and {@code CRASH}.
|
* instead of <a href="https://www.man7.org/linux/man-pages/man3/stderr.3.html">the standard error</a> for logging {@code ERROR} and {@code CRASH}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #loggerForceStandardOutput}.
|
* Gets the value for {@link #loggerForceStandardOutput}.
|
||||||
*
|
*
|
||||||
|
@ -260,12 +244,11 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
private boolean loggerForceStandardOutput;
|
private boolean loggerForceStandardOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines how fast the logging thread will poll for queued messages.
|
* Contains how fast the logging thread will poll for queued messages.
|
||||||
* Only applies if {@code optimizeLogging} is turned on.
|
* Only applies if {@code optimizeLogging} is turned on.
|
||||||
*
|
*
|
||||||
* @see #optimizeLogging
|
* @see #optimizeLogging
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #loggerForceStandardOutput}.
|
* Gets the value for {@link #loggerForceStandardOutput}.
|
||||||
*
|
*
|
||||||
|
@ -278,13 +261,12 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
/**
|
/**
|
||||||
* Will truncate the path of types when using their {@code toString} method.
|
* Will truncate the path of types when using their {@code toString} method.
|
||||||
* <p>
|
* <p>
|
||||||
* Here's an example: Lets say that you have a {@link Vec2} and to convert it
|
* Here's an example: Lets say that you have a {@link Vec2f} and to convert it
|
||||||
* to a String, which you can do with {@link Vec2#toString()}. With this flag disabled
|
* to a String, which you can do with {@link Vec2f#toString()}. With this flag disabled
|
||||||
* it would return {@code de.staropensource.sosengine.base.types.vectors.Vec2(x=64 y=64)},
|
* it would return {@code de.staropensource.sosengine.base.types.vectors.Vec2(x=64 y=64)},
|
||||||
* with it however it would be {@code Vec2(x=64 y=64)}, which is much smaller.
|
* with it however it would be {@code Vec2(x=64 y=64)}, which is much smaller.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Gets the value for {@link #hideFullTypePath}.
|
* Gets the value for {@link #hideFullTypePath}.
|
||||||
*
|
*
|
||||||
|
@ -301,31 +283,21 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public EngineConfiguration() {
|
public EngineConfiguration() {
|
||||||
|
super("ENGINE"); // TODO Wait for flexible constructor bodies (JEP 482) to be implemented into the JVM as a stable feature. We don't want to use preview features in production code.
|
||||||
|
|
||||||
// Only allow one instance
|
// Only allow one instance
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = this;
|
instance = this;
|
||||||
else
|
else
|
||||||
Logger.crash(new LogIssuer(getClass(), CodePart.ENGINE), "Tried initializing " + getClass().getName() + " twice");
|
logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
|
||||||
|
|
||||||
// Load default configuration
|
// Load default configuration
|
||||||
loadDefaultConfiguration();
|
loadDefaultConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public synchronized void loadConfiguration(@NotNull Properties properties) {
|
@Override
|
||||||
// Define variables
|
protected void matchProperty(@NotNull PropertyParser parser, @NotNull String property) {
|
||||||
PropertyParser parser = new PropertyParser(properties);
|
|
||||||
|
|
||||||
// Loop through all properties
|
|
||||||
for (String property : properties.stringPropertyNames()) {
|
|
||||||
// Check if property name starts with group
|
|
||||||
if (!property.startsWith(group))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Skip to important stuff
|
|
||||||
property = property.substring(group.length());
|
|
||||||
|
|
||||||
// Overwrite matching settings
|
|
||||||
try {
|
try {
|
||||||
switch (property) {
|
switch (property) {
|
||||||
case "debug" -> debug = parser.getBoolean(group + property);
|
case "debug" -> debug = parser.getBoolean(group + property);
|
||||||
|
@ -355,6 +327,9 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
} catch (NullPointerException ignored) {}
|
} catch (NullPointerException ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
protected void processSettings(@NotNull PropertyParser parser) {
|
||||||
// Disable all debugging switches if 'debug' is disabled
|
// Disable all debugging switches if 'debug' is disabled
|
||||||
if (!debug) {
|
if (!debug) {
|
||||||
debugEvents = false;
|
debugEvents = false;
|
||||||
|
@ -363,12 +338,8 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public synchronized void loadConfiguration() {
|
@Override
|
||||||
loadConfiguration(System.getProperties());
|
public void loadDefaultConfiguration() {
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
public synchronized void loadDefaultConfiguration() {
|
|
||||||
debug = false;
|
debug = false;
|
||||||
debugEvents = false;
|
debugEvents = false;
|
||||||
debugShortcodeConverter = false;
|
debugShortcodeConverter = false;
|
||||||
|
@ -389,8 +360,8 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Nullable
|
@Override
|
||||||
public Object getSetting(@NotNull String setting) {
|
public @Nullable Object getSetting(@NotNull String setting) {
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case "debug" -> { return debug; }
|
case "debug" -> { return debug; }
|
||||||
case "debugEvents" -> { return debugEvents; }
|
case "debugEvents" -> { return debugEvents; }
|
||||||
|
|
|
@ -19,16 +19,15 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.annotations;
|
package de.staropensource.sosengine.base.annotations;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemClass;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This annotation marks a class as a subsystem main class.
|
* Marks a class as a subsystem main class.
|
||||||
* <p>
|
* Make sure your subsystem implements {@link SubsystemClass}.
|
||||||
* Make sure your subsystem implements {@link SubsystemMainClass}.
|
|
||||||
*
|
*
|
||||||
* @see SubsystemMainClass
|
* @see SubsystemClass
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -26,7 +26,8 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This annotation allows methods to listen on certain events.
|
* Marks a method as an event listener, allowing it
|
||||||
|
* to respond to an events when it is emitted.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
@ -36,18 +37,20 @@ import java.lang.annotation.*;
|
||||||
@Documented
|
@Documented
|
||||||
public @interface EventListener {
|
public @interface EventListener {
|
||||||
/**
|
/**
|
||||||
* The event to listen for.
|
* Specifies the event to listen for.
|
||||||
*
|
*
|
||||||
* @return the event the method listens for
|
* @return event to listen on
|
||||||
|
* @see Event
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull Class<? extends Event> event();
|
||||||
Class<? extends Event> event();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The priority of the event.
|
* Specifies the priority of the event.
|
||||||
*
|
*
|
||||||
* @return the event priority
|
* @return event priority
|
||||||
|
* @see EventPriority
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull EventPriority priority() default EventPriority.DEFAULT;
|
||||||
EventPriority priority() default EventPriority.DEFAULT;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains annotations that are used by the engine
|
* Annotations used by the sos!engine to access
|
||||||
* to dynamically invoke methods or register classes.
|
* classes and methods using reflection.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
* 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.classes;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
|
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for implementing configuration classes.
|
||||||
|
* <p>
|
||||||
|
* Configuration classes use {@link Properties} objects to modify
|
||||||
|
* their settings as they can be supplied to the JVM's arguments
|
||||||
|
* and can be written to and read from during runtime.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public abstract class Configuration {
|
||||||
|
/**
|
||||||
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
|
*
|
||||||
|
* @see LoggerInstance
|
||||||
|
* @since v1-alpha1
|
||||||
|
*/
|
||||||
|
protected final @NotNull LoggerInstance logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs this class.
|
||||||
|
*
|
||||||
|
* @param origin see {@link LoggerInstance.Builder#setOrigin(String)}
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
public Configuration(@NotNull String origin) {
|
||||||
|
// Set logger instance
|
||||||
|
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin(origin).build();
|
||||||
|
|
||||||
|
// Load default configuration
|
||||||
|
loadDefaultConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads all settings from the specified {@link Properties} object.
|
||||||
|
* Unless you want to override settings, consider invoking {@link #loadDefaultConfiguration()} first.
|
||||||
|
*
|
||||||
|
* @param properties {@link Properties} to read from
|
||||||
|
* @see #loadDefaultConfiguration()
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
public void loadConfiguration(@NotNull Properties properties) {
|
||||||
|
PropertyParser parser = new PropertyParser(properties);
|
||||||
|
|
||||||
|
// Loop through all properties
|
||||||
|
for (String property : properties.stringPropertyNames()) {
|
||||||
|
// Check if property name starts with group
|
||||||
|
if (!property.startsWith(getGroup()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Remove group
|
||||||
|
property = property.substring(getGroup().length());
|
||||||
|
|
||||||
|
// Overwrite matching settings
|
||||||
|
try {
|
||||||
|
matchProperty(parser, property);
|
||||||
|
} catch (NullPointerException ignored) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
processSettings(parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads all settings from the system properties.
|
||||||
|
* Useful if you want to allow the user to modify settings at startup.
|
||||||
|
*
|
||||||
|
* @see #loadConfiguration(Properties)
|
||||||
|
* @see System#getProperties()
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
public void loadConfiguration() {
|
||||||
|
loadConfiguration(System.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the group in which setting overrides must begin with.
|
||||||
|
*
|
||||||
|
* @return property group
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
public abstract @NotNull String getGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the default subsystem configuration.
|
||||||
|
*
|
||||||
|
* @see #loadConfiguration()
|
||||||
|
* @see #loadConfiguration(Properties)
|
||||||
|
* @since v1-alpha0
|
||||||
|
*/
|
||||||
|
public abstract void loadDefaultConfiguration();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matches the given {@code property} against all settings.
|
||||||
|
* If a match has been found, the setting will be overwritten with the property's value.
|
||||||
|
*
|
||||||
|
* @param parser matching {@link PropertyParser}
|
||||||
|
* @param property property to match
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
protected abstract void matchProperty(@NotNull PropertyParser parser, @NotNull String property);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows the implementor to process all settings and potentially
|
||||||
|
* modify them before {@link #loadConfiguration(Properties)} returns.
|
||||||
|
*
|
||||||
|
* @param parser matching {@link PropertyParser}
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
protected abstract void processSettings(@NotNull PropertyParser parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a configuration setting.
|
||||||
|
*
|
||||||
|
* @param setting setting name
|
||||||
|
* @return setting's value or {@code null} if not found
|
||||||
|
*/
|
||||||
|
public abstract @Nullable Object getSetting(@NotNull String setting);
|
||||||
|
}
|
|
@ -19,15 +19,18 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.classes;
|
package de.staropensource.sosengine.base.classes;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an event.
|
* Represents an event.
|
||||||
*
|
*
|
||||||
|
* @see EventHelper
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public interface Event {
|
public interface Event {
|
||||||
/**
|
/**
|
||||||
* Calls the event and notifies all annotated methods.
|
* Emits the event and calls all event listeners.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.classes;
|
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for implementing custom logger implementations, called by {@link de.staropensource.sosengine.base.logging.Logger}.
|
|
||||||
*
|
|
||||||
* @see de.staropensource.sosengine.base.logging.Logger
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unused" })
|
|
||||||
public interface LoggerImpl {
|
|
||||||
/**
|
|
||||||
* Run before placeholders are replaced.
|
|
||||||
*
|
|
||||||
* @param level log level
|
|
||||||
* @param logIssuer log issuer
|
|
||||||
* @param message log message
|
|
||||||
* @return new log message
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
String prePlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run after placeholders are replaced.
|
|
||||||
*
|
|
||||||
* @param level log level
|
|
||||||
* @param logIssuer log issuer
|
|
||||||
* @param format log format
|
|
||||||
* @return new log format
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Responsible for printing the finalized log message.
|
|
||||||
*
|
|
||||||
* @param level log level
|
|
||||||
* @param logIssuer log issuer
|
|
||||||
* @param format finalized log format
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format);
|
|
||||||
}
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.classes;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
|
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for implementing custom logger implementations.
|
||||||
|
*
|
||||||
|
* @see Logger#setLoggerImplementation(LoggerImplementation)
|
||||||
|
* @since v1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public interface LoggerImplementation {
|
||||||
|
/**
|
||||||
|
* Invoked before anything is done with the log message.
|
||||||
|
*
|
||||||
|
* @param level level
|
||||||
|
* @param issuerClass issuer class
|
||||||
|
* @param issuerOrigin issuer origin
|
||||||
|
* @param issuerMetadata issuer metadata
|
||||||
|
* @param message raw message
|
||||||
|
* @param format unmodified log format
|
||||||
|
* @return new log message, return {@code null} for no change
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
@Nullable String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked after placeholders have been processed and replaced.
|
||||||
|
*
|
||||||
|
* @param level level
|
||||||
|
* @param issuerClass issuer class
|
||||||
|
* @param issuerOrigin issuer origin
|
||||||
|
* @param issuerMetadata issuer metadata
|
||||||
|
* @param message raw message
|
||||||
|
* @param format unmodified log format
|
||||||
|
* @return new log format
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
@NotNull String postPlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the log message.
|
||||||
|
*
|
||||||
|
* @param level level
|
||||||
|
* @param issuerClass issuer class
|
||||||
|
* @param issuerOrigin issuer origin
|
||||||
|
* @param issuerMetadata issuer metadata
|
||||||
|
* @param message raw message
|
||||||
|
* @param format unmodified log format
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
void print(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format);
|
||||||
|
}
|
|
@ -31,12 +31,11 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public interface Placeholder {
|
public interface Placeholder {
|
||||||
/**
|
/**
|
||||||
* Replaces the placeholder with it's appropriate content.
|
* Replaces the placeholder with content.
|
||||||
*
|
*
|
||||||
* @param text text to process
|
* @param text text to process
|
||||||
* @return the processed text
|
* @return processed text
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull String replace(@NotNull String text);
|
||||||
String replace(@NotNull String text);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ package de.staropensource.sosengine.base.classes;
|
||||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||||
import de.staropensource.sosengine.base.exceptions.ParserException;
|
import de.staropensource.sosengine.base.exceptions.ParserException;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -31,7 +29,11 @@ import java.util.LinkedList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base skeleton for implementing a shortcode parser.
|
* Base class for implementing a shortcode converter.
|
||||||
|
* <p>
|
||||||
|
* This class parses a string and converts it into a list of
|
||||||
|
* components, which can then be in turn be converted to something
|
||||||
|
* else, for example, ANSI escape codes.
|
||||||
* <p>
|
* <p>
|
||||||
* The following shortcodes are available and can be used:
|
* The following shortcodes are available and can be used:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -42,61 +44,58 @@ import java.util.Locale;
|
||||||
* <li>italic</li>
|
* <li>italic</li>
|
||||||
* <li>strikethrough</li>
|
* <li>strikethrough</li>
|
||||||
* <li>underline</li>
|
* <li>underline</li>
|
||||||
* <li>blink</li>
|
|
||||||
* <li>negative</li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
public abstract class ShortcodeParserSkeleton {
|
public abstract class ShortcodeParserSkeleton {
|
||||||
/**
|
/**
|
||||||
* Logger instance.
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
*
|
*
|
||||||
* @see LoggerInstance
|
* @see LoggerInstance
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
protected final LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
protected final @NotNull LoggerInstance logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of components the parsed string is made out of.
|
* Contains a list of components the parsed text is made out of.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns a list of components the parsed string is made out of.
|
* Returns a list of components the parsed text is made out of.
|
||||||
*
|
*
|
||||||
* @return component list of the parsed string
|
* @return component list
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
@Getter
|
@Getter
|
||||||
protected final LinkedList<String> components;
|
protected final @NotNull LinkedList<String> components;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param string string to parse
|
* @param string string to parse
|
||||||
* @param ignoreInvalidEscapes will ignore invalid escapes and print treat them like regular text
|
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
|
||||||
* @throws ParserException when parsing failed
|
* @throws ParserException on error
|
||||||
* @since v1-alpha1
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public ShortcodeParserSkeleton(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
public ShortcodeParserSkeleton(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
||||||
|
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
|
||||||
components = parse(string, ignoreInvalidEscapes);
|
components = parse(string, ignoreInvalidEscapes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an input string and spits out all of it's components.
|
* Parses the input string and returns a list
|
||||||
|
* of components the text is made out of.
|
||||||
*
|
*
|
||||||
* @param string string to parse
|
* @param string string to parse
|
||||||
* @param ignoreInvalidEscapes will ignore invalid escapes and print treat them like regular text
|
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
|
||||||
* @return list of components
|
* @return list of components
|
||||||
* @throws ParserException when parsing failed
|
* @throws ParserException on error
|
||||||
* @see EngineConfiguration#errorShortcodeConverter
|
* @see EngineConfiguration#errorShortcodeConverter
|
||||||
* @since v1-alpha1
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
||||||
protected LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
|
|
||||||
LinkedList<String> components = new LinkedList<>(); // List of components
|
LinkedList<String> components = new LinkedList<>(); // List of components
|
||||||
boolean tagActive = false; // Indicates that a tag is being parsed
|
boolean tagActive = false; // Indicates that a tag is being parsed
|
||||||
boolean escape = false; // Indicates whether the last character was a \ character
|
boolean escape = false; // Indicates whether the last character was a \ character
|
||||||
|
@ -276,18 +275,17 @@ public abstract class ShortcodeParserSkeleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the supplied color tag and returns if it's valid.
|
* Returns if the specified color is valid
|
||||||
*
|
*
|
||||||
|
* @return {@code true} if valid, {@code false} otherwise
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
private boolean isValidColor(@NotNull String color) {
|
private boolean isValidColor(@NotNull String color) {
|
||||||
switch (color.toLowerCase(Locale.ROOT)) {
|
return switch (color.toLowerCase(Locale.ROOT)) {
|
||||||
case "black", "white", "red", "green", "blue", "yellow", "magenta", "cyan" -> {
|
case "black", "white", "red",
|
||||||
return true;
|
"green", "blue", "yellow",
|
||||||
}
|
"magenta", "cyan" -> true;
|
||||||
default -> {
|
default -> false;
|
||||||
return false;
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,53 +28,60 @@ import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface for engine subsystem main classes.
|
* Interface for building subsystem main classes.
|
||||||
*
|
*
|
||||||
* @see EngineSubsystem
|
* @see EngineSubsystem
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public interface SubsystemMainClass {
|
public abstract class SubsystemClass {
|
||||||
/**
|
/**
|
||||||
* Logger instance.
|
* Constructs this class.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
public SubsystemClass() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
*
|
*
|
||||||
* @see LoggerInstance
|
* @see LoggerInstance
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
LoggerInstance logger = null;
|
public final LoggerInstance logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of this subsystem.
|
* Returns the name of the subsystem.
|
||||||
*
|
*
|
||||||
|
* @return subsystem name
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public abstract @NotNull String getName();
|
||||||
String getName();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes this subsystem.
|
* Initializes the subsystem.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
void initializeSubsystem();
|
public abstract void initializeSubsystem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link DependencyVector} for this subsystem.
|
* Returns a matching {@link DependencyVector}.
|
||||||
|
* Used for dependency resolution during startup.
|
||||||
*
|
*
|
||||||
* @return {@link DependencyVector} for this subsystem
|
* @return matching {@link DependencyVector} for the subsystem
|
||||||
* @since v1-alpha1
|
|
||||||
* @see DependencyVector
|
* @see DependencyVector
|
||||||
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public abstract @NotNull DependencyVector getDependencyVector();
|
||||||
DependencyVector getDependencyVector();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the engine shuts down.
|
* Called on engine shutdown.
|
||||||
*
|
*
|
||||||
* @see Engine#shutdown()
|
* @see Engine#shutdown()
|
||||||
* @see Engine#shutdown(int)
|
* @see Engine#shutdown(int)
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@EventListener(event = InternalEngineShutdownEvent.class)
|
@EventListener(event = InternalEngineShutdownEvent.class)
|
||||||
static void shutdown() {}
|
protected static void shutdownSubsystem() {}
|
||||||
}
|
}
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.classes;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for subsystem configurations.
|
|
||||||
*
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unused" })
|
|
||||||
public interface SubsystemConfiguration {
|
|
||||||
/**
|
|
||||||
* Contains the class instance.
|
|
||||||
*
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
SubsystemConfiguration instance = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the group every property must start with to be recognized as a subsystem configuration setting.
|
|
||||||
*
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
String group = "sosengine.";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the subsystem configuration from the specified {@link Properties}.<br/>
|
|
||||||
* Unless you want to allow configuration overriding, resetting the configuration using {@code loadDefaultConfiguration()} is advised.
|
|
||||||
*
|
|
||||||
* @param properties {@link Properties} object
|
|
||||||
* @see SubsystemConfiguration#loadDefaultConfiguration()
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
void loadConfiguration(@NotNull Properties properties);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the subsystem configuration from the system properties.
|
|
||||||
*
|
|
||||||
* @see SubsystemConfiguration#loadConfiguration(Properties)
|
|
||||||
* @see System#getProperties()
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
void loadConfiguration();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the default subsystem configuration.
|
|
||||||
*
|
|
||||||
* @see SubsystemConfiguration#loadConfiguration()
|
|
||||||
* @see SubsystemConfiguration#loadConfiguration(Properties)
|
|
||||||
* @since v1-alpha0
|
|
||||||
*/
|
|
||||||
void loadDefaultConfiguration();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a configuration setting.
|
|
||||||
*
|
|
||||||
* @param setting setting name
|
|
||||||
* @return setting's value or {@code null} if not found
|
|
||||||
*/
|
|
||||||
Object getSetting(@NotNull String setting);
|
|
||||||
}
|
|
|
@ -24,27 +24,26 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface used for implementing different versioning systems.
|
* Interface for building a versioning system (parser).
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public interface VersioningSystem {
|
public interface VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Returns the name of this versioning system.
|
* Returns the name of the versioning system.
|
||||||
*
|
*
|
||||||
* @return name of this versioning system
|
* @return versioning system name
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull String getName();
|
||||||
String getName();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares a version with another version.
|
* Compares a {@link VersioningSystem} with another.
|
||||||
*
|
*
|
||||||
* @param version the version to compare against
|
* @param version {@link VersioningSystem} to compare against
|
||||||
* @return smaller = {@code 0}, equal = {@code 1}, bigger = {@code 2}
|
* @return smaller = {@code 0}, equal = {@code 1}, bigger = {@code 2}
|
||||||
* @throws IncompatibleVersioningSystemException when this versioning system does not support comparing with another versioning system
|
* @throws IncompatibleVersioningSystemException incompatible with the supplied versioning system
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Range(from = 0, to = 2)
|
@Range(from = 0, to = 2)
|
||||||
|
|
|
@ -28,12 +28,9 @@ import de.staropensource.sosengine.base.exceptions.reflection.InstanceMethodFrom
|
||||||
import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodSignature;
|
import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodSignature;
|
||||||
import de.staropensource.sosengine.base.exceptions.reflection.NoAccessException;
|
import de.staropensource.sosengine.base.exceptions.reflection.NoAccessException;
|
||||||
import de.staropensource.sosengine.base.exceptions.reflection.StaticInitializerException;
|
import de.staropensource.sosengine.base.exceptions.reflection.StaticInitializerException;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.reflection.Reflect;
|
import de.staropensource.sosengine.base.reflection.Reflect;
|
||||||
import de.staropensource.sosengine.base.reflection.ReflectionMethod;
|
import de.staropensource.sosengine.base.reflection.ReflectionMethod;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.utility.ListFormatter;
|
import de.staropensource.sosengine.base.utility.ListFormatter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -51,7 +48,7 @@ import java.util.LinkedList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an event.
|
* Simplifies event logging and calling.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
@ -59,48 +56,58 @@ import java.util.Set;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class EventHelper {
|
public final class EventHelper {
|
||||||
/**
|
/**
|
||||||
* Contains all cached event listeners.
|
* Holds all cached events.
|
||||||
|
* Should not be modified manually.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
private static final HashMap<@NotNull Class<? extends Event>, LinkedList<@NotNull ReflectionMethod>> cachedEventListeners = new HashMap<>();
|
private static final @NotNull HashMap<@NotNull Class<? extends Event>, LinkedList<@NotNull ReflectionMethod>> cachedEventListeners = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
|
*
|
||||||
|
* @see LoggerInstance
|
||||||
|
* @since v1-alpha1
|
||||||
|
*/
|
||||||
|
private static final @NotNull LoggerInstance logger = new LoggerInstance.Builder().setClazz(EventHelper.class).setOrigin("ENGINE").build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public EventHelper() {}
|
public EventHelper() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the event call.
|
* Logs an event call.
|
||||||
*
|
*
|
||||||
* @param clazz event class
|
* @param event event class
|
||||||
* @param arguments arguments passed to event listeners
|
* @param arguments arguments passed to event listeners
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public static void logCall(@NotNull Class<? extends Event> clazz, @NotNull Object ... arguments) {
|
public static void logCall(@NotNull Class<? extends Event> event, @NotNull Object ... arguments) {
|
||||||
// Print event call if event debugging is enabled
|
// Print event call if event debugging is enabled
|
||||||
if (EngineConfiguration.getInstance().isDebugEvents())
|
if (EngineConfiguration.getInstance().isDebugEvents())
|
||||||
if (arguments.length == 0)
|
if (arguments.length == 0)
|
||||||
Logger.diag(new LogIssuer(clazz), "Event " + clazz.getName() + " emitted");
|
logger.diag("Event " + event.getName() + " was emitted");
|
||||||
else
|
else
|
||||||
Logger.diag(new LogIssuer(clazz), "Event " + clazz.getName() + " emitted, passing arguments " + ListFormatter.formatArray(arguments));
|
logger.diag("Event " + event.getName() + " was emitted, passing arguments " + ListFormatter.formatArray(arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all event listeners.
|
* Returns all {@link EventListener}s listening on some event.
|
||||||
|
* The classpath will be scanned for listeners, unless cached results exist and {@code !forceScanning}.
|
||||||
*
|
*
|
||||||
* @param clazz event class
|
* @param event event class
|
||||||
* @param forceScanning forces the method to ignore cached event listeners, not recommended
|
* @param forceScanning forces scanning the classpath for listeners. not recommended due to a huge performance penalty
|
||||||
* @return list of annotated methods
|
* @return list of event listeners
|
||||||
|
* @see #cacheEvent(Class)
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull LinkedList<ReflectionMethod> getAnnotatedMethods(@NotNull Class<? extends Event> event, boolean forceScanning) {
|
||||||
public static LinkedList<ReflectionMethod> getAnnotatedMethods(@NotNull Class<? extends Event> clazz, boolean forceScanning) {
|
|
||||||
LinkedList<ReflectionMethod> methods = new LinkedList<>();
|
LinkedList<ReflectionMethod> methods = new LinkedList<>();
|
||||||
|
|
||||||
if (forceScanning || !cachedEventListeners.containsKey(clazz)) {
|
if (forceScanning || !cachedEventListeners.containsKey(event)) {
|
||||||
// Scan entire classpath through Reflections library
|
|
||||||
// (enforced or not cached)
|
|
||||||
Reflections reflections = new Reflections(
|
Reflections reflections = new Reflections(
|
||||||
new ConfigurationBuilder()
|
new ConfigurationBuilder()
|
||||||
.setUrls(ClasspathHelper.forJavaClassPath())
|
.setUrls(ClasspathHelper.forJavaClassPath())
|
||||||
|
@ -112,38 +119,38 @@ public final class EventHelper {
|
||||||
|
|
||||||
// Sort event listeners not listening for this event out
|
// Sort event listeners not listening for this event out
|
||||||
for (Method method : annotatedMethods)
|
for (Method method : annotatedMethods)
|
||||||
if (method.getAnnotation(EventListener.class).event() == clazz)
|
if (method.getAnnotation(EventListener.class).event() == event)
|
||||||
methods.add(Reflect.reflectOn(method));
|
methods.add(Reflect.reflectOn(method));
|
||||||
|
|
||||||
// Sort 'methods' linked list after event priority
|
// Sort 'methods' linked list after event priority
|
||||||
methods.sort(Comparator.comparing(method -> method.getAnnotation(EventListener.class).priority()));
|
methods.sort(Comparator.comparing(method -> method.getAnnotation(EventListener.class).priority()));
|
||||||
} else
|
} else
|
||||||
// 'forcedScanning' is false and matching event listeners are cached
|
// Event listeners are cached and !forceScanning, return cached results
|
||||||
methods = cachedEventListeners.get(clazz);
|
methods = cachedEventListeners.get(event);
|
||||||
|
|
||||||
return methods;
|
return methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all matching event listeners.
|
* Returns all {@link EventListener}s listening on some event.
|
||||||
|
* The classpath will be scanned for listeners, unless cached results exist.
|
||||||
*
|
*
|
||||||
* @param clazz event class
|
* @param event event class
|
||||||
* @return list of annotated methods
|
* @return list of event listeners
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull LinkedList<ReflectionMethod> getAnnotatedMethods(@NotNull Class<? extends Event> event) {
|
||||||
public static LinkedList<ReflectionMethod> getAnnotatedMethods(@NotNull Class<? extends Event> clazz) {
|
return getAnnotatedMethods(event, false);
|
||||||
return getAnnotatedMethods(clazz, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes all matching event listeners without any arguments.
|
* Invokes all event listeners.
|
||||||
*
|
*
|
||||||
* @param event event class
|
* @param event event class
|
||||||
|
* @param arguments arguments to pass to event listeners
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public static void invokeAnnotatedMethods(@NotNull Class<? extends Event> event, Object... arguments) {
|
public static void invokeAnnotatedMethods(@NotNull Class<? extends Event> event, Object... arguments) {
|
||||||
LoggerInstance logger = new LoggerInstance(new LogIssuer(EventHelper.class, event.getName(), CodePart.ENGINE));
|
|
||||||
if (event != LogEvent.class)
|
if (event != LogEvent.class)
|
||||||
logCall(event);
|
logCall(event);
|
||||||
|
|
||||||
|
@ -177,36 +184,35 @@ public final class EventHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches all event listeners listening on some event.
|
* (Re-)Caches all event listeners for some {@link Event}.
|
||||||
* Will recompute all event listeners if the specified event is already cached.
|
|
||||||
*
|
*
|
||||||
* @param clazz event listeners to (p)recompute, set to {@code null} to recompute all cached events
|
* @param event event to (re-)cache. Set to {@code null} to recompute all cached events
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public static synchronized void precomputeEventListeners(@Nullable Class<? extends Event> clazz) {
|
public static synchronized void cacheEvent(@Nullable Class<? extends Event> event) {
|
||||||
if (clazz == null)
|
if (event == null)
|
||||||
for (Class<? extends Event> event : cachedEventListeners.keySet())
|
for (Class<? extends Event> cachedEvent : cachedEventListeners.keySet())
|
||||||
precomputeEventListeners(event);
|
cacheEvent(cachedEvent);
|
||||||
else {
|
else {
|
||||||
LinkedList<@NotNull ReflectionMethod> annotatedMethods = getAnnotatedMethods(clazz);
|
LinkedList<@NotNull ReflectionMethod> annotatedMethods = getAnnotatedMethods(event);
|
||||||
|
|
||||||
if (cachedEventListeners.containsKey(clazz))
|
if (cachedEventListeners.containsKey(event))
|
||||||
cachedEventListeners.replace(clazz, annotatedMethods);
|
cachedEventListeners.replace(event, annotatedMethods);
|
||||||
else
|
else
|
||||||
cachedEventListeners.put(clazz, annotatedMethods);
|
cachedEventListeners.put(event, annotatedMethods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes events from the event listener cache.
|
* Removes an event from the event listener cache.
|
||||||
*
|
*
|
||||||
* @param clazz event class to remove cached event listeners for or {@code null} to remove all cached event listeners
|
* @param event event to uncache. Set to {@code null} to clear the entire cache
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public static synchronized void removePrecomputedEventListeners(@Nullable Class<? extends Event> clazz) {
|
public static synchronized void uncacheEvent(@Nullable Class<? extends Event> event) {
|
||||||
if (clazz == null)
|
if (event == null)
|
||||||
cachedEventListeners.clear();
|
cachedEventListeners.clear();
|
||||||
else
|
else
|
||||||
cachedEventListeners.remove(clazz);
|
cachedEventListeners.remove(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains various interfaces and abstract classes.
|
* Interfaces and abstract classes which can be used for implementing classes.
|
||||||
|
* <p>
|
||||||
|
* These are not to be confused with data types. See {@link de.staropensource.sosengine.base.types}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,16 +17,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.data.info;
|
package de.staropensource.sosengine.base.data.information;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.Engine;
|
import de.staropensource.sosengine.base.Engine;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.VersionType;
|
import de.staropensource.sosengine.base.types.VersionType;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
||||||
import de.staropensource.sosengine.base.utility.parser.StackTraceParser;
|
import de.staropensource.sosengine.base.utility.parser.StackTraceParser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -38,17 +37,39 @@ import java.util.GregorianCalendar;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides build information about the sos!engine.
|
* Provides build information about the engine.
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
|
||||||
public final class EngineInformation {
|
|
||||||
/**
|
|
||||||
* Provides the engine's version.
|
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
|
public final class EngineInformation {
|
||||||
|
/**
|
||||||
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
*
|
*
|
||||||
|
* @see LoggerInstance
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
private static final @NotNull LoggerInstance logger = new LoggerInstance.Builder().setClazz(EngineInformation.class).setOrigin("ENGINE").build();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the engine's version codename.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the engine's version.
|
* Returns the engine's version codename.
|
||||||
|
*
|
||||||
|
* @return engine version codename
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private static String versioningCodename;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the engine's version.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
|
* -- GETTER --
|
||||||
|
* Returns the engine's version.
|
||||||
*
|
*
|
||||||
* @return engine version
|
* @return engine version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -57,12 +78,11 @@ public final class EngineInformation {
|
||||||
private static int versioningVersion;
|
private static int versioningVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the engine's version type.
|
* Contains the engine's version type.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the engine's version type.
|
* Returns the engine's version type.
|
||||||
*
|
*
|
||||||
* @return engine version type
|
* @return engine version type
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -71,12 +91,11 @@ public final class EngineInformation {
|
||||||
private static VersionType versioningType;
|
private static VersionType versioningType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the engine's type release.
|
* Contains the engine's typerelease.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the engine's type release.
|
* Returns the engine's typerelease.
|
||||||
*
|
*
|
||||||
* @return engine typerelease
|
* @return engine typerelease
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -85,14 +104,15 @@ public final class EngineInformation {
|
||||||
private static int versioningTyperelease;
|
private static int versioningTyperelease;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the engine's fork identifier.<br/>
|
* Contains the engine's fork identifier.
|
||||||
* Likely empty. If not, it must be prefixed with a dash.
|
* <p>
|
||||||
|
* Likely empty. If not, prefixed with a dash.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the engine's fork identifier.<br/>
|
* Returns the engine's fork identifier.
|
||||||
* Likely empty. If not, it must be prefixed with a dash.
|
* <p>
|
||||||
|
* Likely empty. If not, prefixed with a dash.
|
||||||
*
|
*
|
||||||
* @return engine fork identifier
|
* @return engine fork identifier
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -101,12 +121,11 @@ public final class EngineInformation {
|
||||||
private static String versioningFork;
|
private static String versioningFork;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the engine's full version string.
|
* Contains the engine's full version string.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the engine's full version string.
|
* Returns the engine's full version string.
|
||||||
*
|
*
|
||||||
* @return engine version string
|
* @return engine version string
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -116,26 +135,24 @@ public final class EngineInformation {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the {@code dirty} value (i.e. if the source tree has been modified).
|
* Contains the {@code dirty} value (i.e. if the source tree has been modified).
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the {@code dirty} value (i.e. if the source tree has been modified).
|
* Returns the {@code dirty} value (i.e. if the source tree has been modified).
|
||||||
*
|
*
|
||||||
* @return git dirty value
|
* @return git dirty value
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private static Boolean gitDirty;
|
private static boolean gitDirty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the branch the engine was built on.
|
* Contains the branch the engine was built on.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the branch the engine was built on.
|
* Returns the branch the engine was built on.
|
||||||
*
|
*
|
||||||
* @return git branch
|
* @return git branch
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -144,12 +161,11 @@ public final class EngineInformation {
|
||||||
private static String gitBranch;
|
private static String gitBranch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commit count.
|
* Contains the commit count.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commit count.
|
* Returns the commit count.
|
||||||
*
|
*
|
||||||
* @return git commit count
|
* @return git commit count
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -158,12 +174,11 @@ public final class EngineInformation {
|
||||||
private static int gitCommitCount;
|
private static int gitCommitCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commit identifier (short form).
|
* Contains the commit identifier (short form).
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commit identifier (short form).
|
* Returns the commit identifier (short form).
|
||||||
*
|
*
|
||||||
* @return git long commit id
|
* @return git long commit id
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -172,12 +187,11 @@ public final class EngineInformation {
|
||||||
private static String gitCommitIdentifierShort;
|
private static String gitCommitIdentifierShort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commit identifier (long form).
|
* Contains the commit identifier (long form).
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commit identifier (long form).
|
* Returns the commit identifier (long form).
|
||||||
*
|
*
|
||||||
* @return git long commit id
|
* @return git long commit id
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -186,12 +200,11 @@ public final class EngineInformation {
|
||||||
private static String gitCommitIdentifierLong;
|
private static String gitCommitIdentifierLong;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commit header.
|
* Contains the commit header.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commit header.
|
* Returns the commit header.
|
||||||
*
|
*
|
||||||
* @return git commit header
|
* @return git commit header
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -200,12 +213,11 @@ public final class EngineInformation {
|
||||||
private static String gitCommitHeader;
|
private static String gitCommitHeader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commit time.
|
* Contains the commit time.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commit time.
|
* Returns the commit time.
|
||||||
*
|
*
|
||||||
* @return git commit time
|
* @return git commit time
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -214,12 +226,11 @@ public final class EngineInformation {
|
||||||
private static ZonedDateTime gitCommitTime;
|
private static ZonedDateTime gitCommitTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commiter's name.
|
* Contains the commiter's name.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commiter's name.
|
* Returns the commiter's name.
|
||||||
*
|
*
|
||||||
* @return git committer name
|
* @return git committer name
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -228,12 +239,11 @@ public final class EngineInformation {
|
||||||
private static String gitCommitterName;
|
private static String gitCommitterName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the commiter's email.
|
* Contains the commiter's email.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the commiter's email.
|
* Returns the commiter's email.
|
||||||
*
|
*
|
||||||
* @return git committer email
|
* @return git committer email
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -243,12 +253,11 @@ public final class EngineInformation {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the version of the dependency {@code Jansi}.
|
* Contains the version of the dependency {@code Jansi}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the version of the dependency {@code Jansi}.
|
* Returns the version of the dependency {@code Jansi}.
|
||||||
*
|
*
|
||||||
* @return Jansi dependency version
|
* @return Jansi dependency version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -257,12 +266,11 @@ public final class EngineInformation {
|
||||||
private static String dependencyJansi;
|
private static String dependencyJansi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the version of the dependency {@code Reflections}.
|
* Contains the version of the dependency {@code Reflections}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the version of the dependency {@code Reflections}.
|
* Returns the version of the dependency {@code Reflections}.
|
||||||
*
|
*
|
||||||
* @return Reflections dependency version
|
* @return Reflections dependency version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -271,12 +279,11 @@ public final class EngineInformation {
|
||||||
private static String dependencyReflections;
|
private static String dependencyReflections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the version of the dependency {@code SLF4J}.
|
* Contains the version of the dependency {@code SLF4J}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the version of the dependency {@code SLF4J}.
|
* Returns the version of the dependency {@code SLF4J}.
|
||||||
*
|
*
|
||||||
* @return SLF4J dependency version
|
* @return SLF4J dependency version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -285,12 +292,11 @@ public final class EngineInformation {
|
||||||
private static String dependencySlf4j;
|
private static String dependencySlf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the version of the dependency {@code LWJGL}.
|
* Contains the version of the dependency {@code LWJGL}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Provides the version of the dependency {@code LWJGL}.
|
* Returns the version of the dependency {@code LWJGL}.
|
||||||
*
|
*
|
||||||
* @return LWJGL dependency version
|
* @return LWJGL dependency version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
|
@ -307,12 +313,13 @@ public final class EngineInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates all variables.
|
* Updates all variables.
|
||||||
|
* <p>
|
||||||
|
* This method does not need to be invoked, as the information provided by this
|
||||||
|
* class is static (does not change) and is already populated at engine startup.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static synchronized void updateVariables() {
|
public static synchronized void updateVariables() {
|
||||||
LoggerInstance logger = new LoggerInstance(new LogIssuer(EngineInformation.class, CodePart.ENGINE));
|
|
||||||
|
|
||||||
// Load properties from bundled gradle.properties
|
// Load properties from bundled gradle.properties
|
||||||
Properties gradleProperties = new Properties();
|
Properties gradleProperties = new Properties();
|
||||||
InputStream gradleStream = EngineInformation.class.getClassLoader().getResourceAsStream("gradle.properties");
|
InputStream gradleStream = EngineInformation.class.getClassLoader().getResourceAsStream("gradle.properties");
|
||||||
|
@ -370,6 +377,7 @@ public final class EngineInformation {
|
||||||
PropertyParser gitParser = new PropertyParser(gitProperties);
|
PropertyParser gitParser = new PropertyParser(gitProperties);
|
||||||
|
|
||||||
// Apply properties to fields
|
// Apply properties to fields
|
||||||
|
versioningCodename = gradleParser.getString("versioningCodename");
|
||||||
versioningVersion = gradleParser.getInteger("versioningVersion", true);
|
versioningVersion = gradleParser.getInteger("versioningVersion", true);
|
||||||
versioningType = VersionType.valueOf(gradleParser.getString("versioningType").toUpperCase());
|
versioningType = VersionType.valueOf(gradleParser.getString("versioningType").toUpperCase());
|
||||||
versioningTyperelease = gradleParser.getInteger("versioningTyperelease", true);
|
versioningTyperelease = gradleParser.getInteger("versioningTyperelease", true);
|
|
@ -17,11 +17,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.data.info;
|
package de.staropensource.sosengine.base.data.information;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
@ -30,9 +28,19 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides information about the running Java Virtual Machine.
|
* Provides information about the running Java Virtual Machine.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class JvmInformation {
|
public final class JvmInformation {
|
||||||
|
/**
|
||||||
|
* Contains the {@link LoggerInstance} for this instance.
|
||||||
|
*
|
||||||
|
* @see LoggerInstance
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
private static final @NotNull LoggerInstance logger = new LoggerInstance.Builder().setClazz(JvmInformation.class).setOrigin("ENGINE").build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
|
@ -43,8 +51,8 @@ public final class JvmInformation {
|
||||||
/**
|
/**
|
||||||
* Returns the Java version this JVM implements.
|
* Returns the Java version this JVM implements.
|
||||||
*
|
*
|
||||||
* @return the Java version
|
* @return Java version
|
||||||
* @throws NumberFormatException if the version could not be converted into an int
|
* @throws NumberFormatException on integer conversion failure
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public static int getJavaVersion() throws NumberFormatException {
|
public static int getJavaVersion() throws NumberFormatException {
|
||||||
|
@ -60,7 +68,7 @@ public final class JvmInformation {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(version);
|
return Integer.parseInt(version);
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
Logger.crash(new LogIssuer(JvmInformation.class, CodePart.ENGINE), "Could not parse Java version: Integer conversion failed for string \"" + version + "\"", exception, true);
|
logger.crash("Could not parse Java version: Integer conversion failed for string \"" + version + "\"", exception, true);
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,33 +76,30 @@ public final class JvmInformation {
|
||||||
/**
|
/**
|
||||||
* Returns the JVM implementation name.
|
* Returns the JVM implementation name.
|
||||||
*
|
*
|
||||||
* @return the JVM implementation name
|
* @return implementation name
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull String getImplementationName() {
|
||||||
public static String getImplementationName() {
|
|
||||||
return ManagementFactory.getRuntimeMXBean().getVmName();
|
return ManagementFactory.getRuntimeMXBean().getVmName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the JVM implementation version.
|
* Returns the JVM implementation version.
|
||||||
*
|
*
|
||||||
* @return the JVM implementation version
|
* @return implementation version
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull String getImplementationVersion() {
|
||||||
public static String getImplementationVersion() {
|
|
||||||
return ManagementFactory.getRuntimeMXBean().getVmVersion();
|
return ManagementFactory.getRuntimeMXBean().getVmVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the JVM implementation vendor.
|
* Returns the JVM implementation vendor.
|
||||||
*
|
*
|
||||||
* @return the JVM implementation vendor
|
* @return implementation vendor
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull String getImplementationVendor() {
|
||||||
public static String getImplementationVendor() {
|
|
||||||
return ManagementFactory.getRuntimeMXBean().getVmVendor();
|
return ManagementFactory.getRuntimeMXBean().getVmVendor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,20 +114,18 @@ public final class JvmInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the arguments passed to the JVM (not to the running program).
|
* Returns all arguments passed to the JVM.
|
||||||
|
* This excludes all arguments passed to the application.
|
||||||
*
|
*
|
||||||
* @return the JVM arguments
|
* @return JVM arguments
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
public static @NotNull List<@NotNull String> getArguments() {
|
||||||
public static List<@NotNull String> getArguments() {
|
|
||||||
return ManagementFactory.getRuntimeMXBean().getInputArguments();
|
return ManagementFactory.getRuntimeMXBean().getInputArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total amount of memory used the running application AND JVM.
|
* Returns the <b>estimated</b> total amount of memory used the running application and JVM.
|
||||||
* <p>
|
|
||||||
* Note: This is an estimate.
|
|
||||||
*
|
*
|
||||||
* @return estimated total amount of used memory
|
* @return estimated total amount of used memory
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
@ -132,19 +135,19 @@ public final class JvmInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum amount of memory usable by the running application.
|
* Returns the maximum amount of memory which can be used by the running application.
|
||||||
*
|
*
|
||||||
* @return maximum amount of usable memory
|
* @return maximum amount of memory usable in bytes
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static long getMemoryMax() {
|
public static long getMemoryLimit() {
|
||||||
return Runtime.getRuntime().maxMemory();
|
return Runtime.getRuntime().maxMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of free memory available to the running application.
|
* Returns the amount of free memory available to the running application.
|
||||||
*
|
*
|
||||||
* @return amount of free memory
|
* @return amount of free memory in bytes
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static long getMemoryFree() {
|
public static long getMemoryFree() {
|
||||||
|
@ -154,37 +157,37 @@ public final class JvmInformation {
|
||||||
/**
|
/**
|
||||||
* Returns the amount of memory used by the running application.
|
* Returns the amount of memory used by the running application.
|
||||||
*
|
*
|
||||||
* @return amount of used memory
|
* @return amount of used memory in bytes
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static long getMemoryUsed() {
|
public static long getMemoryUsed() {
|
||||||
return getMemoryMax() - getMemoryFree();
|
return getMemoryLimit() - getMemoryFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the memory usage of the heap.
|
* Returns the size of <a href="https://en.wikipedia.org/wiki/Heap_(programming)">heap memory</a>.
|
||||||
*
|
*
|
||||||
* @return heap usage
|
* @return heap memory size
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static MemoryUsage getMemoryHeap() {
|
public static @NotNull MemoryUsage getMemoryHeap() {
|
||||||
return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the memory usage of the stack.
|
* Returns size of <a href="https://en.wikipedia.org/wiki/Stack-based_memory_allocation">stack memory</a>.
|
||||||
*
|
*
|
||||||
* @return stack usage
|
* @return stack memory size
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
public static MemoryUsage getMemoryStack() {
|
public static @NotNull MemoryUsage getMemoryStack() {
|
||||||
return ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
|
return ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of processors used by the JVM.
|
* Returns the amount of processors available to the JVM.
|
||||||
* <p>
|
* <p>
|
||||||
* Note: The amount of processors used may change rapidly.
|
* Note: The amount of available processors may change rapidly.
|
||||||
* If your application scales resources based on the output of
|
* If your application scales resources based on the output of
|
||||||
* this method, consider checking it's output often and scaling
|
* this method, consider checking it's output often and scaling
|
||||||
* resources accordingly.
|
* resources accordingly.
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides various classes that can be used to retrieve information about the engine or JVM.
|
* Classes which can be used to retrieve information about the execution environment.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
package de.staropensource.sosengine.base.data.info;
|
package de.staropensource.sosengine.base.data.information;
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains various packages with tiny classes that provide or process information.
|
* Classes which provide or process information.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,65 +32,60 @@ import org.jetbrains.annotations.Range;
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class FourNumberVersioningSystem implements VersioningSystem {
|
public final class FourNumberVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the 1. number vector.
|
* Contains the first number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 1. number vector.
|
* Returns the first number vector.
|
||||||
*
|
*
|
||||||
* @return 1. number vector
|
* @return first number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number1;
|
private final int number1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 2. number vector.
|
* Contains the second number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 2. number vector.
|
* Returns the second number vector.
|
||||||
*
|
*
|
||||||
* @return 2. number vector
|
* @return second number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number2;
|
private final int number2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 3. number vector.
|
* Contains the third number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 3. number vector.
|
* Returns the third number vector.
|
||||||
*
|
*
|
||||||
* @return 3. number vector
|
* @return third number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number3;
|
private final int number3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 4. number vector.
|
* Contains the fourth number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 4. number vector.
|
* Returns the fourth number vector.
|
||||||
*
|
*
|
||||||
* @return 4. number vector
|
* @return fourth number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number4;
|
private final int number4;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "n4";
|
return "n4";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,18 +27,17 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a two-numbered versioning system, where an application or work is versioning by two arbitrary numbers.
|
* Represents a one-numbered versioning system, where an application or work is versioned by one arbitrary number.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class OneNumberVersioningSystem implements VersioningSystem {
|
public final class OneNumberVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the number vector.
|
* Contains the number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the number vector.
|
* Returns the number vector.
|
||||||
*
|
*
|
||||||
|
@ -48,9 +47,8 @@ public final class OneNumberVersioningSystem implements VersioningSystem {
|
||||||
private final int number;
|
private final int number;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "n1";
|
return "n1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +78,6 @@ public final class OneNumberVersioningSystem implements VersioningSystem {
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
throw new IncompatibleVersioningSystemException(this, versionInterface);
|
throw new IncompatibleVersioningSystemException(this, versionInterface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,83 +33,78 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the semantic versioning system (version 2.0.0), where an application or work is versioning by a MAJOR version, a MINOR version, a PATCH version and optionally, a pre-release vector and a build number.
|
* Represents the semantic versioning system (version 2.0.0), where an application
|
||||||
|
* or work is versioning by a {@code MAJOR} version, {@code MINOR} version,
|
||||||
|
* {@code PATCH} version and optionally, a pre-release vector and a build number.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class SemanticVersioningSystem implements VersioningSystem {
|
public final class SemanticVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the MAJOR vector.
|
* Contains the {@code MAJOR} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the MAJOR vector.
|
* Returns the {@code MAJOR} vector.
|
||||||
*
|
*
|
||||||
* @return MAJOR vector
|
* @return {@code MAJOR} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int major;
|
private final int major;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the MINOR vector.
|
* Contains the {@code MINOR} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the MINOR vector.
|
* Returns the {@code MINOR} vector.
|
||||||
*
|
*
|
||||||
* @return MINOR vector
|
* @return {@code MINOR} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int minor;
|
private final int minor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the PATCH vector.
|
* Contains the {@code PATCH} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the PATCH vector.
|
* Returns the {@code PATCH} vector.
|
||||||
*
|
*
|
||||||
* @return PATCH vector
|
* @return {@code PATCH} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int patch;
|
private final int patch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the PRERELEASE vector.
|
* Contains the {@code PRERELEASE} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the PRERELEASE vector.
|
* Returns the {@code PRERELEASE} vector.
|
||||||
*
|
*
|
||||||
* @return PRERELEASE vector
|
* @return {@code PRERELEASE} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Nullable
|
private final @Nullable String prerelease;
|
||||||
private final String prerelease;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the BUILD vector.
|
* Contains the {@code BUILD} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the BUILD vector.
|
* Returns the {@code BUILD} vector.
|
||||||
*
|
*
|
||||||
* @return BUILD vector
|
* @return {@code BUILD} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int build;
|
private final int build;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "Semantic";
|
return "Semantic";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,71 +33,68 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the StarOpenSource versioning system (version 2), where an application or work is versioning by a VERSION vector, a TYPE version type, a TYPERELEASE vector and optionally, a fork vector and a companion vector.
|
* Represents the StarOpenSource versioning system (version 2), where an application
|
||||||
|
* or work is versioning by a {@code VERSION} vector, {@code TYPE} version type,
|
||||||
|
* {@code TYPERELEASE} vector and optionally, a {@code FORK} vector and
|
||||||
|
* {@code COMPANION} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class StarOpenSourceVersioningSystem implements VersioningSystem {
|
public final class StarOpenSourceVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the VERSION vector.
|
* Contains the {@code VERSION} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the VERSION vector.
|
* Returns the {@code VERSION} vector.
|
||||||
*
|
*
|
||||||
* @return VERSION vector
|
* @return {@code VERSION} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int version;
|
private final int version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the TYPE vector.
|
* Contains the {@code TYPE} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the TYPE vector.
|
* Returns the {@code TYPE} vector.
|
||||||
*
|
*
|
||||||
* @return TYPE vector
|
* @return {@code TYPE} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final VersionType type;
|
private final VersionType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the TYPERELEASE vector.
|
* Contains the {@code TYPERELEASE} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the TYPERELEASE vector.
|
* Returns the {@code TYPERELEASE}- vector.
|
||||||
*
|
*
|
||||||
* @return TYPERELEASE vector
|
* @return {@code TYPERELEASE} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int typerelease;
|
private final int typerelease;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the COMPANION vector.
|
* Contains the {@code COMPANION} vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the COMPANION vector.
|
* Returns the {@code COMPANION} vector.
|
||||||
*
|
*
|
||||||
* @return COMPANION vector
|
* @return {@code COMPANION} vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Nullable
|
private final @Nullable String companion;
|
||||||
private final String companion;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the FORK vector.
|
* Contains the FORK vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the FORK vector.
|
* Returns the FORK vector.
|
||||||
*
|
*
|
||||||
|
@ -107,9 +104,8 @@ public final class StarOpenSourceVersioningSystem implements VersioningSystem {
|
||||||
private final String fork;
|
private final String fork;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "StarOpenSource";
|
return "StarOpenSource";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,52 +32,48 @@ import org.jetbrains.annotations.Range;
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class ThreeNumberVersioningSystem implements VersioningSystem {
|
public final class ThreeNumberVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the 1. number vector.
|
* Contains the first number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 1. number vector.
|
* Returns the first number vector.
|
||||||
*
|
*
|
||||||
* @return 1. number vector
|
* @return first number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number1;
|
private final int number1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 2. number vector.
|
* Contains the second number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 2. number vector.
|
* Returns the second number vector.
|
||||||
*
|
*
|
||||||
* @return 2. number vector
|
* @return second number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number2;
|
private final int number2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 3. number vector.
|
* Contains the third number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 3. number vector.
|
* Returns the third number vector.
|
||||||
*
|
*
|
||||||
* @return 3. number vector
|
* @return third number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number3;
|
private final int number3;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "n3";
|
return "n3";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,39 +32,36 @@ import org.jetbrains.annotations.Range;
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public final class TwoNumberVersioningSystem implements VersioningSystem {
|
public final class TwoNumberVersioningSystem implements VersioningSystem {
|
||||||
/**
|
/**
|
||||||
* Contains the 1. number vector.
|
* Contains the first number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 1. number vector.
|
* Returns the first number vector.
|
||||||
*
|
*
|
||||||
* @return 1. number vector
|
* @return first number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number1;
|
private final int number1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the 2. number vector.
|
* Contains the second number vector.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the 2. number vector.
|
* Returns the second number vector.
|
||||||
*
|
*
|
||||||
* @return 2. number vector
|
* @return second number vector
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
private final int number2;
|
private final int number2;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public @NotNull String getName() {
|
||||||
return "n2";
|
return "n2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +78,7 @@ public final class TwoNumberVersioningSystem implements VersioningSystem {
|
||||||
// Escape separator or throw error if invalid
|
// Escape separator or throw error if invalid
|
||||||
switch (separator) {
|
switch (separator) {
|
||||||
case "." -> separator = "\\.";
|
case "." -> separator = "\\.";
|
||||||
case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are either one dot ('.') or hyphen ('-').");
|
case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are either one dot ('.') or hyphen ('-')");
|
||||||
default -> {}
|
default -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +90,7 @@ public final class TwoNumberVersioningSystem implements VersioningSystem {
|
||||||
this.number1 = Integer.parseUnsignedInt(versionStringSplit[0]);
|
this.number1 = Integer.parseUnsignedInt(versionStringSplit[0]);
|
||||||
this.number2 = Integer.parseUnsignedInt(versionStringSplit[1]);
|
this.number2 = Integer.parseUnsignedInt(versionStringSplit[1]);
|
||||||
} catch (NumberFormatException exception) {
|
} catch (NumberFormatException exception) {
|
||||||
throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer.", exception);
|
throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains built-in versioning systems that
|
* Built-in versioning systems which
|
||||||
* can be used to represent versions of some work.
|
* can be used to represent versions of some work.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
|
|
@ -23,14 +23,16 @@ import de.staropensource.sosengine.base.classes.Event;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called in the event of an engine crash, just before the JVM exists.
|
* Called in the event of an engine crash.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class EngineCrashEvent implements Event {
|
public final class EngineCrashEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public EngineCrashEvent() {}
|
public EngineCrashEvent() {}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,15 @@ import de.staropensource.sosengine.base.classes.Event;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the engine and JVM are about to shutdown.
|
* Called when the engine is about to shutdown.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public final class EngineShutdownEvent implements Event {
|
public final class EngineShutdownEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public EngineShutdownEvent() {}
|
public EngineShutdownEvent() {}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,22 @@ package de.staropensource.sosengine.base.events;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Event;
|
import de.staropensource.sosengine.base.classes.Event;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called in the event of a soft engine crash
|
* Called in the event of a soft engine crash
|
||||||
* ie. a crash which was declared as handled.
|
* ie. when a crash report is thrown but marked
|
||||||
|
* as handled.
|
||||||
*
|
*
|
||||||
|
* @see Logger#crash(Class, String, String, String, Throwable, boolean)
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class EngineSoftCrashEvent implements Event {
|
public final class EngineSoftCrashEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public EngineSoftCrashEvent() {}
|
public EngineSoftCrashEvent() {}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ package de.staropensource.sosengine.base.events;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Event;
|
import de.staropensource.sosengine.base.classes.Event;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a new log message is printed.
|
* Called before a new log message is printed.
|
||||||
|
@ -33,28 +33,32 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class LogEvent implements Event {
|
public final class LogEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public LogEvent() {}
|
public LogEvent() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @deprecated use the {@code callEvent} method with arguments
|
* @deprecated use the {@code callEvent} method with arguments
|
||||||
* @see LogEvent#callEvent(LogLevel, LogIssuer, String)
|
* @see #callEvent(LogLevel, Class, String, String, String)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void callEvent() {}
|
public void callEvent() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the event and notifies all annotated methods.
|
* Emits the event and calls all event listeners.
|
||||||
*
|
*
|
||||||
* @param level log level
|
* @param level level
|
||||||
* @param logIssuer log issuer
|
* @param issuerClass issuer class
|
||||||
* @param message log message
|
* @param issuerOrigin issuer origin
|
||||||
|
* @param issuerMetadata issuer metadata
|
||||||
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public void callEvent(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
|
public void callEvent(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message) {
|
||||||
EventHelper.invokeAnnotatedMethods(getClass(), level, logIssuer, message);
|
EventHelper.invokeAnnotatedMethods(getClass(), level, issuerClass, issuerOrigin, issuerMetadata, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,16 @@ import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an exception is caught.
|
* Called when an exception is caught by {@link Miscellaneous#executeSafely(Runnable, String)}.
|
||||||
*
|
*
|
||||||
* @see Miscellaneous#executeSafely(Runnable, String)
|
* @see Miscellaneous#executeSafely(Runnable, String)
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public final class ThrowableCatchEvent implements Event {
|
public final class ThrowableCatchEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public ThrowableCatchEvent() {}
|
public ThrowableCatchEvent() {}
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ public final class ThrowableCatchEvent implements Event {
|
||||||
public void callEvent() {}
|
public void callEvent() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the event and notifies all annotated methods.
|
* Emits the event and calls all event listeners.
|
||||||
*
|
*
|
||||||
* @param throwable caught throwable
|
* @param throwable caught throwable
|
||||||
* @param identifier an identifier given to the runnable
|
* @param identifier an identifier given to the runnable
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains events. There's nothing more to say.
|
* Events. There's nothing more to say.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,6 +27,12 @@ import org.jetbrains.annotations.NotNull;
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public class ParserException extends RuntimeException {
|
public class ParserException extends RuntimeException {
|
||||||
|
/**
|
||||||
|
* Constructs this exception.
|
||||||
|
*
|
||||||
|
* @param message parsing error
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
public ParserException(@NotNull String message) {
|
public ParserException(@NotNull String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,21 @@ package de.staropensource.sosengine.base.exceptions;
|
||||||
import de.staropensource.sosengine.base.types.Tristate;
|
import de.staropensource.sosengine.base.types.Tristate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when converting a {@link Tristate} into a boolean fails.
|
* Thrown when converting a {@link Tristate} into a {@link Boolean} fails.
|
||||||
* <p>
|
* <p>
|
||||||
* This exception inherits {@link RuntimeException} on purpose, as sometimes
|
* This exception inherits {@link RuntimeException} on purpose,
|
||||||
* you expect or have already validated the {@link Tristate} not being {@link Tristate#UNSET}.
|
* as sometimes you may sure/have already validated that the
|
||||||
|
* {@link Tristate} is not {@link Tristate#UNSET}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
public class TristateConversionException extends RuntimeException {
|
public class TristateConversionException extends RuntimeException {
|
||||||
|
/**
|
||||||
|
* Constructs this exception.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
public TristateConversionException() {
|
public TristateConversionException() {
|
||||||
super("Can't convert Tristate.UNSET into a boolean");
|
super("Tristate.UNSET cannot be converted into a boolean");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,27 +23,24 @@ import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an exception caused by some throwable.
|
* Thrown when a method invokes another method and it throws an unhandled {@link Throwable}.
|
||||||
* Basic wrapper for every throwable there is.
|
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public class UnexpectedThrowableException extends Exception {
|
public class UnexpectedThrowableException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Contains the throwable supplied to the constructor.
|
* Contains the throwable supplied to the constructor.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the throwable supplied by the constructor.
|
* Returns the throwable supplied by the constructor.
|
||||||
*
|
*
|
||||||
* @return throwable
|
* @return throwable
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull Throwable throwable;
|
||||||
Throwable throwable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this exception.
|
* Constructs this exception.
|
||||||
|
|
|
@ -19,15 +19,16 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.exceptions.dependency;
|
package de.staropensource.sosengine.base.exceptions.dependency;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an exception caused by a dependency cycle.
|
* Thrown when the {@link DependencyResolver} detects a dependency cycle.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public class DependencyCycleException extends Exception {
|
public class DependencyCycleException extends RuntimeException {
|
||||||
/**
|
/**
|
||||||
* Constructs this exception.
|
* Constructs this exception.
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,45 +20,45 @@
|
||||||
package de.staropensource.sosengine.base.exceptions.dependency;
|
package de.staropensource.sosengine.base.exceptions.dependency;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.types.DependencyVector;
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
|
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an exception caused by unmet dependencies.
|
* Thrown when the {@link DependencyResolver} cannot resolve one
|
||||||
|
* or more {@link DependencyVector}s due to unmet dependencies.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
@Getter
|
@Getter
|
||||||
public class UnmetDependenciesException extends Exception {
|
public class UnmetDependenciesException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Contains the unmet dependencies list supplied to the constructor.
|
* Contains the unmet dependencies list supplied to the constructor.
|
||||||
* <p>
|
* <p>
|
||||||
* The key contains the {@link DependencyVector} that has unmet dependencies,
|
* The key contains the {@link DependencyVector} that
|
||||||
* while the value contains the error string ie. which dependency is unmet and why.
|
* has unmet dependencies, while the value contains the error.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the unmet dependencies list supplied to the constructor.
|
* Returns the unmet dependencies list supplied to the constructor.
|
||||||
* <p>
|
* <p>
|
||||||
* The key contains the {@link DependencyVector} that has unmet dependencies,
|
* The key contains the {@link DependencyVector} that
|
||||||
* while the value contains the error string ie. which dependency is unmet and why.
|
* has unmet dependencies, while the value contains the error.
|
||||||
*
|
*
|
||||||
* @return unmet dependencies list
|
* @return unmet dependencies list
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull Map<@NotNull DependencyVector, @NotNull String> unmetDependencies;
|
||||||
private final Map<@NotNull DependencyVector, @NotNull String> unmetDependencies;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this exception.
|
* Constructs this exception.
|
||||||
*
|
*
|
||||||
* @param unmetDependencies map of unmet dependencies
|
* @param unmetDependencies map of all unmet dependencies
|
||||||
|
* @see #unmetDependencies
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
* @see UnmetDependenciesException#unmetDependencies
|
|
||||||
*/
|
*/
|
||||||
public UnmetDependenciesException(@NotNull Map<@NotNull DependencyVector, @NotNull String> unmetDependencies) {
|
public UnmetDependenciesException(@NotNull Map<@NotNull DependencyVector, @NotNull String> unmetDependencies) {
|
||||||
this.unmetDependencies = unmetDependencies;
|
this.unmetDependencies = unmetDependencies;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains exceptions related to dependency resolving.
|
* Exceptions related to dependency resolving.
|
||||||
*
|
*
|
||||||
* @see de.staropensource.sosengine.base.utility.DependencyResolver
|
* @see de.staropensource.sosengine.base.utility.DependencyResolver
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains exceptions thrown by the engine.
|
* Exceptions thrown by the engine, subsystems and applications.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,7 @@ import de.staropensource.sosengine.base.utility.ListFormatter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when the method called does not apply to the class type.
|
* Thrown when the invoked method does not apply to the type of the class.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
|
@ -40,4 +40,15 @@ public class IncompatibleTypeException extends RuntimeException {
|
||||||
public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType[] compatibleTypes) {
|
public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType[] compatibleTypes) {
|
||||||
super("The method ReflectionClass#" + methodName + " only applies to type(s) " + ListFormatter.formatArray(compatibleTypes) + ", not " + requiredClassType.name());
|
super("The method ReflectionClass#" + methodName + " only applies to type(s) " + ListFormatter.formatArray(compatibleTypes) + ", not " + requiredClassType.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs this exception.
|
||||||
|
*
|
||||||
|
* @param methodName name of the method that failed
|
||||||
|
* @param requiredClassType class type received by the method
|
||||||
|
* @param compatibleType class type the method is compatible with
|
||||||
|
*/
|
||||||
|
public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType compatibleType) {
|
||||||
|
super("The method ReflectionClass#" + methodName + " only applies to type(s) " + ListFormatter.formatArray(new ClassType[]{ compatibleType }) + ", not " + requiredClassType.name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ package de.staropensource.sosengine.base.exceptions.reflection;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when trying to call a non-static method from a static context.
|
* Thrown when trying to call an instance (non-static) method from a static context.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,18 @@ package de.staropensource.sosengine.base.exceptions.reflection;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when a method could not be found due to an invalid method signature.
|
||||||
|
*
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
public class InvalidMethodSignature extends Exception {
|
public class InvalidMethodSignature extends Exception {
|
||||||
|
/**
|
||||||
|
* Constructs this exception.
|
||||||
|
*
|
||||||
|
* @param methodName method name
|
||||||
|
*/
|
||||||
public InvalidMethodSignature(@NotNull String methodName) {
|
public InvalidMethodSignature(@NotNull String methodName) {
|
||||||
super("Method " + methodName + " has a different method signature");
|
super("Method " + methodName + " has a different method signature");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,19 @@ package de.staropensource.sosengine.base.exceptions.reflection;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown if access to some class, method or field is denied.
|
* Thrown if access to some class, method or field has been denied.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public class NoAccessException extends Exception {
|
public class NoAccessException extends Exception {
|
||||||
|
/**
|
||||||
|
* Constructs this exception.
|
||||||
|
*
|
||||||
|
* @param type {@code class}, {@code method} or {@code field}
|
||||||
|
* @param name class, method or field name
|
||||||
|
* @since v1-alpha2
|
||||||
|
*/
|
||||||
public NoAccessException(@NotNull String type, @NotNull String name) {
|
public NoAccessException(@NotNull String type, @NotNull String name) {
|
||||||
super("Access to " + type + " " + name + " has been denied");
|
super("Access to " + type + " " + name + " has been denied");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,26 +23,24 @@ import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when an exception occurs
|
* Thrown when an exception is thrown by a static initializer.
|
||||||
* while executing a static initializer.
|
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
public class StaticInitializerException extends Exception {
|
public class StaticInitializerException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Contains the throwable supplied to the constructor.
|
* Contains the throwable thrown by the static initializer.
|
||||||
*
|
*
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the throwable supplied to the constructor.
|
* Returns the throwable thrown by the static initializer.
|
||||||
*
|
*
|
||||||
* @return throwable thrown by the static initializer
|
* @return throwable thrown by the static initializer
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
private final Throwable throwable;
|
private final @NotNull Throwable throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this exception.
|
* Constructs this exception.
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains exceptions used during reflection.
|
* Exceptions related to reflection.
|
||||||
*
|
*
|
||||||
* @see de.staropensource.sosengine.base.reflection.Reflect
|
* @see de.staropensource.sosengine.base.reflection
|
||||||
* @since v1-alpha2
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
package de.staropensource.sosengine.base.exceptions.reflection;
|
package de.staropensource.sosengine.base.exceptions.reflection;
|
||||||
|
|
|
@ -22,7 +22,8 @@ package de.staropensource.sosengine.base.exceptions.versioning;
|
||||||
import de.staropensource.sosengine.base.classes.VersioningSystem;
|
import de.staropensource.sosengine.base.classes.VersioningSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an exception caused by supplying an invalid or unexpected versioning system.
|
* Thrown when trying to compare a {@link VersioningSystem} against another
|
||||||
|
* {@link VersioningSystem}, which it does not support.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,26 +26,29 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an exception caused by an invalid version string.
|
* Thrown when an invalid version string is supplied
|
||||||
|
* to an implementation of {@link VersioningSystem}.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration" })
|
||||||
public class InvalidVersionStringException extends Exception {
|
public class InvalidVersionStringException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Contains the throwable supplied to the constructor.
|
* Contains the throwable supplied to the constructor.
|
||||||
*
|
*
|
||||||
|
* @see #InvalidVersionStringException(VersioningSystem, String, Throwable)
|
||||||
|
* @see #InvalidVersionStringException(VersioningSystem, String, String, Throwable)
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*
|
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the throwable supplied by the constructor.
|
* Returns the throwable supplied by the constructor.
|
||||||
*
|
*
|
||||||
* @return throwable
|
* @return throwable
|
||||||
|
* @see #InvalidVersionStringException(VersioningSystem, String, Throwable)
|
||||||
|
* @see #InvalidVersionStringException(VersioningSystem, String, String, Throwable)
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
@Nullable
|
private final @Nullable Throwable throwable;
|
||||||
private final Throwable throwable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this exception.
|
* Constructs this exception.
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains exceptions thrown by {@link de.staropensource.sosengine.base.classes.VersioningSystem}s.
|
* Exceptions thrown by implementations of {@link de.staropensource.sosengine.base.classes.VersioningSystem}s.
|
||||||
*
|
*
|
||||||
* @see de.staropensource.sosengine.base.classes.VersioningSystem
|
* @see de.staropensource.sosengine.base.classes.VersioningSystem
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
|
|
|
@ -23,17 +23,20 @@ import de.staropensource.sosengine.base.classes.Event;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the engine and JVM are about to shutdown, after {@link de.staropensource.sosengine.base.events.EngineShutdownEvent}.
|
* Called when the engine is about to shutdown, after {@link de.staropensource.sosengine.base.events.EngineShutdownEvent}.
|
||||||
|
* <p>
|
||||||
|
* Meant for subsystems to perform cleanup and shutdown routines, not for applications.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public final class InternalEngineShutdownEvent implements Event {
|
public final class InternalEngineShutdownEvent implements Event {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this event.
|
||||||
|
*
|
||||||
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public InternalEngineShutdownEvent() {}
|
public InternalEngineShutdownEvent() {}
|
||||||
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void callEvent() {
|
public void callEvent() {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains engine-internal stuff, not part of the API.
|
* Engine-internal stuff, not part of the API.
|
||||||
*
|
*
|
||||||
* @since v1-alpha1
|
* @since v1-alpha1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class DateDay implements Placeholder {
|
||||||
public DateDay() {}
|
public DateDay() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%date_day%", Math.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2));
|
return text.replace("%date_day%", Math.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class DateMonth implements Placeholder {
|
||||||
public DateMonth() {}
|
public DateMonth() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%date_month%", Math.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2));
|
return text.replace("%date_month%", Math.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class DateYear implements Placeholder {
|
||||||
public DateYear() {}
|
public DateYear() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%date_year%", Math.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4));
|
return text.replace("%date_year%", Math.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineDependencyJansi implements Placeholder {
|
||||||
public EngineDependencyJansi() {}
|
public EngineDependencyJansi() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_dependency_jansi%", EngineInformation.getDependencyJansi());
|
return text.replace("%engine_dependency_jansi%", EngineInformation.getDependencyJansi());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineDependencyLwjgl implements Placeholder {
|
||||||
public EngineDependencyLwjgl() {}
|
public EngineDependencyLwjgl() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_dependency_lwjgl%", EngineInformation.getDependencyLwjgl());
|
return text.replace("%engine_dependency_lwjgl%", EngineInformation.getDependencyLwjgl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineDependencyReflections implements Placeholder {
|
||||||
public EngineDependencyReflections() {}
|
public EngineDependencyReflections() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_dependency_reflections%", EngineInformation.getDependencyReflections());
|
return text.replace("%engine_dependency_reflections%", EngineInformation.getDependencyReflections());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineDependencySlf4j implements Placeholder {
|
||||||
public EngineDependencySlf4j() {}
|
public EngineDependencySlf4j() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_dependency_slf4j%", EngineInformation.getDependencySlf4j());
|
return text.replace("%engine_dependency_slf4j%", EngineInformation.getDependencySlf4j());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitBranch implements Placeholder {
|
||||||
public EngineGitBranch() {}
|
public EngineGitBranch() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_branch%", EngineInformation.getGitBranch());
|
return text.replace("%engine_git_branch%", EngineInformation.getGitBranch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitHeader implements Placeholder {
|
||||||
public EngineGitCommitHeader() {}
|
public EngineGitCommitHeader() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_header%", EngineInformation.getGitCommitHeader());
|
return text.replace("%engine_git_commit_header%", EngineInformation.getGitCommitHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitIdLong implements Placeholder {
|
||||||
public EngineGitCommitIdLong() {}
|
public EngineGitCommitIdLong() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_id_long%", EngineInformation.getGitCommitIdentifierLong());
|
return text.replace("%engine_git_commit_id_long%", EngineInformation.getGitCommitIdentifierLong());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitIdShort implements Placeholder {
|
||||||
public EngineGitCommitIdShort() {}
|
public EngineGitCommitIdShort() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_id_short%", EngineInformation.getGitCommitIdentifierShort());
|
return text.replace("%engine_git_commit_id_short%", EngineInformation.getGitCommitIdentifierShort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeDay implements Placeholder {
|
||||||
public EngineGitCommitTimeDay() {}
|
public EngineGitCommitTimeDay() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_day%", String.valueOf(EngineInformation.getGitCommitTime().getDayOfMonth()));
|
return text.replace("%engine_git_commit_time_day%", String.valueOf(EngineInformation.getGitCommitTime().getDayOfMonth()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeHour implements Placeholder {
|
||||||
public EngineGitCommitTimeHour() {}
|
public EngineGitCommitTimeHour() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_hour%", String.valueOf(EngineInformation.getGitCommitTime().getHour()));
|
return text.replace("%engine_git_commit_time_hour%", String.valueOf(EngineInformation.getGitCommitTime().getHour()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeMinute implements Placeholder {
|
||||||
public EngineGitCommitTimeMinute() {}
|
public EngineGitCommitTimeMinute() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_minute%", String.valueOf(EngineInformation.getGitCommitTime().getMinute()));
|
return text.replace("%engine_git_commit_time_minute%", String.valueOf(EngineInformation.getGitCommitTime().getMinute()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeMonth implements Placeholder {
|
||||||
public EngineGitCommitTimeMonth() {}
|
public EngineGitCommitTimeMonth() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_month%", String.valueOf(EngineInformation.getGitCommitTime().getMonth()));
|
return text.replace("%engine_git_commit_time_month%", String.valueOf(EngineInformation.getGitCommitTime().getMonth()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeSecond implements Placeholder {
|
||||||
public EngineGitCommitTimeSecond() {}
|
public EngineGitCommitTimeSecond() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_second%", String.valueOf(EngineInformation.getGitCommitTime().getSecond()));
|
return text.replace("%engine_git_commit_time_second%", String.valueOf(EngineInformation.getGitCommitTime().getSecond()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitTimeYear implements Placeholder {
|
||||||
public EngineGitCommitTimeYear() {}
|
public EngineGitCommitTimeYear() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commit_time_year%", String.valueOf(EngineInformation.getGitCommitTime().getYear()));
|
return text.replace("%engine_git_commit_time_year%", String.valueOf(EngineInformation.getGitCommitTime().getYear()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommits implements Placeholder {
|
||||||
public EngineGitCommits() {}
|
public EngineGitCommits() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_commits%", String.valueOf(EngineInformation.getGitCommitCount()));
|
return text.replace("%engine_git_commits%", String.valueOf(EngineInformation.getGitCommitCount()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitterEmail implements Placeholder {
|
||||||
public EngineGitCommitterEmail() {}
|
public EngineGitCommitterEmail() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_committer_email%", EngineInformation.getGitCommitterEmail());
|
return text.replace("%engine_git_committer_email%", EngineInformation.getGitCommitterEmail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitCommitterName implements Placeholder {
|
||||||
public EngineGitCommitterName() {}
|
public EngineGitCommitterName() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_committer_name%", EngineInformation.getGitCommitterName());
|
return text.replace("%engine_git_committer_name%", EngineInformation.getGitCommitterName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineGitDirty implements Placeholder {
|
||||||
public EngineGitDirty() {}
|
public EngineGitDirty() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_git_dirty%", String.valueOf(EngineInformation.getGitDirty()));
|
return text.replace("%engine_git_dirty%", String.valueOf(EngineInformation.isGitDirty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,8 @@ public final class EngineVersion implements Placeholder {
|
||||||
public EngineVersion() {}
|
public EngineVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_version%", "v%engine_version_version%-%engine_version_type%%engine_version_typerelease%%engine_version_fork%");
|
return text.replace("%engine_version%", "v%engine_version_version%-%engine_version_type%%engine_version_typerelease%%engine_version_fork%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineVersionFork implements Placeholder {
|
||||||
public EngineVersionFork() {}
|
public EngineVersionFork() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_version_fork%", EngineInformation.getVersioningFork());
|
return text.replace("%engine_version_fork%", EngineInformation.getVersioningFork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineVersionType implements Placeholder {
|
||||||
public EngineVersionType() {}
|
public EngineVersionType() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_version_type%", EngineInformation.getVersioningType().name().toLowerCase());
|
return text.replace("%engine_version_type%", EngineInformation.getVersioningType().name().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineVersionTyperelease implements Placeholder {
|
||||||
public EngineVersionTyperelease() {}
|
public EngineVersionTyperelease() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_version_typerelease%", String.valueOf(EngineInformation.getVersioningTyperelease()));
|
return text.replace("%engine_version_typerelease%", String.valueOf(EngineInformation.getVersioningTyperelease()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.information.EngineInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class EngineVersionVersion implements Placeholder {
|
||||||
public EngineVersionVersion() {}
|
public EngineVersionVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%engine_version_version%", String.valueOf(EngineInformation.getVersioningVersion()));
|
return text.replace("%engine_version_version%", String.valueOf(EngineInformation.getVersioningVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmArguments implements Placeholder {
|
||||||
public JvmArguments() {}
|
public JvmArguments() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
StringBuilder arguments = new StringBuilder();
|
StringBuilder arguments = new StringBuilder();
|
||||||
|
|
||||||
for (String argument : JvmInformation.getArguments()) {
|
for (String argument : JvmInformation.getArguments()) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmImplementationName implements Placeholder {
|
||||||
public JvmImplementationName() {}
|
public JvmImplementationName() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%jvm_implementation_name%", JvmInformation.getImplementationName());
|
return text.replace("%jvm_implementation_name%", JvmInformation.getImplementationName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmImplementationVendor implements Placeholder {
|
||||||
public JvmImplementationVendor() {}
|
public JvmImplementationVendor() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%jvm_implementation_vendor%", JvmInformation.getImplementationVendor());
|
return text.replace("%jvm_implementation_vendor%", JvmInformation.getImplementationVendor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmImplementationVersion implements Placeholder {
|
||||||
public JvmImplementationVersion() {}
|
public JvmImplementationVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%jvm_implementation_version%", JvmInformation.getImplementationVersion());
|
return text.replace("%jvm_implementation_version%", JvmInformation.getImplementationVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmJava implements Placeholder {
|
||||||
public JvmJava() {}
|
public JvmJava() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%jvm_java%", String.valueOf(JvmInformation.getJavaVersion()));
|
return text.replace("%jvm_java%", String.valueOf(JvmInformation.getJavaVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders;
|
package de.staropensource.sosengine.base.internal.placeholders;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.data.info.JvmInformation;
|
import de.staropensource.sosengine.base.data.information.JvmInformation;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +39,8 @@ public final class JvmUptime implements Placeholder {
|
||||||
public JvmUptime() {}
|
public JvmUptime() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%jvm_uptime%", String.valueOf(JvmInformation.getUptime()));
|
return text.replace("%jvm_uptime%", String.valueOf(JvmInformation.getUptime()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,8 @@ public final class TimeEpoch implements Placeholder {
|
||||||
public TimeEpoch() {}
|
public TimeEpoch() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%time_epoch%", Math.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length()));
|
return text.replace("%time_epoch%", Math.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class TimeHour implements Placeholder {
|
||||||
public TimeHour() {}
|
public TimeHour() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%time_hour%", Math.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2));
|
return text.replace("%time_hour%", Math.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class TimeMinute implements Placeholder {
|
||||||
public TimeMinute() {}
|
public TimeMinute() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%time_minute%", Math.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2));
|
return text.replace("%time_minute%", Math.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class TimeSecond implements Placeholder {
|
||||||
public TimeSecond() {}
|
public TimeSecond() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%time_second%", Math.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2));
|
return text.replace("%time_second%", Math.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,8 @@ public final class TimeZone implements Placeholder {
|
||||||
public TimeZone() {}
|
public TimeZone() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%time_zone%", java.util.TimeZone.getDefault().getDisplayName(false, java.util.TimeZone.SHORT, Locale.US));
|
return text.replace("%time_zone%", java.util.TimeZone.getDefault().getDisplayName(false, java.util.TimeZone.SHORT, Locale.US));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@ import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the {@code issuer_message} placeholder.
|
* Implements the {@code crash_message} placeholder.
|
||||||
*
|
*
|
||||||
* @see Placeholder
|
* @see Placeholder
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerMessage implements Placeholder {
|
public final class CrashMessage implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The message to use.
|
* The message to use.
|
||||||
*
|
*
|
||||||
|
@ -44,14 +44,13 @@ public final class IssuerMessage implements Placeholder {
|
||||||
* @param message message to use
|
* @param message message to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerMessage(@NotNull String message) {
|
public CrashMessage(@NotNull String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%issuer_message%", message);
|
return text.replace("%crash_message%", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,6 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,27 +31,25 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerClass implements Placeholder {
|
public final class IssuerClass implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The {@link LogIssuer} to use.
|
* Issuer class to use.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull Class<?> issuerClass;
|
||||||
private final LogIssuer logIssuer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param logIssuer {@link LogIssuer} to use
|
* @param issuerClass issuer class to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerClass(@NotNull LogIssuer logIssuer) {
|
public IssuerClass(@NotNull Class<?> issuerClass) {
|
||||||
this.logIssuer = logIssuer;
|
this.issuerClass = issuerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%issuer_class%", logIssuer.getClazz().getName().replace(logIssuer.getClazz().getPackageName() + ".", ""));
|
return text.replace("%issuer_class%", issuerClass.getName().replace(issuerClass.getPackageName() + ".", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,44 +20,42 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the {@code issuer_info} placeholder.
|
* Implements the {@code issuer_metadata} placeholder.
|
||||||
*
|
*
|
||||||
* @see Placeholder
|
* @see Placeholder
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerInfo implements Placeholder {
|
public final class IssuerMetadata implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The {@link LogIssuer} to use.
|
* Issuer metadata to use.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @Nullable String issuerMetadata;
|
||||||
private final LogIssuer logIssuer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param logIssuer {@link LogIssuer} to use
|
* @param issuerMetadata issuer metadata to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerInfo(@NotNull LogIssuer logIssuer) {
|
public IssuerMetadata(@Nullable String issuerMetadata) {
|
||||||
this.logIssuer = logIssuer;
|
this.issuerMetadata = issuerMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
String replacement = "\\<none>";
|
String replacement = "\\<none>";
|
||||||
|
|
||||||
if (logIssuer.getAdditionalInformation() != null)
|
if (issuerMetadata != null)
|
||||||
replacement = logIssuer.getAdditionalInformation();
|
replacement = issuerMetadata;
|
||||||
|
|
||||||
return text.replace("%issuer_info%", replacement);
|
return text.replace("%issuer_metadata%", replacement);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,39 +20,38 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the {@code issuer_code_part} placeholder.
|
* Implements the {@code issuer_origin} placeholder.
|
||||||
*
|
*
|
||||||
* @see Placeholder
|
* @see Placeholder
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerCodePart implements Placeholder {
|
public final class IssuerOrigin implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The {@link LogIssuer} to use.
|
* Issuer origin to use.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull String issuerOrigin;
|
||||||
private final LogIssuer logIssuer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param logIssuer {@link LogIssuer} to use
|
* @param issuerOrigin issuer origin to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerCodePart(@NotNull LogIssuer logIssuer) {
|
public IssuerOrigin(@NotNull String issuerOrigin) {
|
||||||
this.logIssuer = logIssuer;
|
this.issuerOrigin = issuerOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%issuer_code_part%", logIssuer.getCodePart().name());
|
return text.replace("%issuer_origin%", issuerOrigin.toUpperCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,6 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,27 +31,25 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerPackage implements Placeholder {
|
public final class IssuerPackage implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The {@link LogIssuer} to use.
|
* Issuer class to use.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull Class<?> issuerClass;
|
||||||
private final LogIssuer logIssuer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param logIssuer {@link LogIssuer} to use
|
* @param issuerClass issuer class to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerPackage(@NotNull LogIssuer logIssuer) {
|
public IssuerPackage(@NotNull Class<?> issuerClass) {
|
||||||
this.logIssuer = logIssuer;
|
this.issuerClass = issuerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%issuer_package%", logIssuer.getClazz().getPackageName());
|
return text.replace("%issuer_package%", issuerClass.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
package de.staropensource.sosengine.base.internal.placeholders.crashhandler;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,27 +31,25 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public final class IssuerPath implements Placeholder {
|
public final class IssuerPath implements Placeholder {
|
||||||
/**
|
/**
|
||||||
* The {@link LogIssuer} to use.
|
* Issuer class to use.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha2
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private final @NotNull Class<?> issuerClass;
|
||||||
private final LogIssuer logIssuer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @param logIssuer {@link LogIssuer} to use
|
* @param issuerClass issuer class to use
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
public IssuerPath(@NotNull LogIssuer logIssuer) {
|
public IssuerPath(@NotNull Class<?> issuerClass) {
|
||||||
this.logIssuer = logIssuer;
|
this.issuerClass = issuerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%issuer_path%", logIssuer.getClazz().getName());
|
return text.replace("%issuer_path%", issuerClass.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ public final class Stacktrace implements Placeholder {
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha0
|
||||||
*/
|
*/
|
||||||
@Nullable
|
private final @Nullable Throwable throwable;
|
||||||
private final Throwable throwable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
|
@ -54,9 +53,8 @@ public final class Stacktrace implements Placeholder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%stacktrace%", throwable == null ? "No stack trace is available." : getFullStackTrace(throwable));
|
return text.replace("%stacktrace%", throwable == null ? "No stack trace is available." : getFullStackTrace(throwable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,8 @@ public final class StacktraceAll implements Placeholder {
|
||||||
public StacktraceAll() {}
|
public StacktraceAll() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
Map<Thread, StackTraceElement[]> stacktraces = Thread.getAllStackTraces();
|
Map<Thread, StackTraceElement[]> stacktraces = Thread.getAllStackTraces();
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue