Rename LoggerImplementation and rename mainClass vars

This commit is contained in:
JeremyStar™ 2024-08-31 22:06:40 +02:00
parent 794f8bb471
commit cfb52106dc
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
14 changed files with 69 additions and 69 deletions

View file

@ -20,7 +20,7 @@
package de.staropensource.sosengine.ansi;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggerImplementation;
import de.staropensource.sosengine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.logging.Logger;
import de.staropensource.sosengine.base.type.logging.LogLevel;
import org.fusesource.jansi.Ansi;
@ -32,16 +32,16 @@ import org.jetbrains.annotations.Nullable;
* Prints colored log output using the Jansi library.
*
* @see Logger
* @see LoggerImplementation
* @see LoggingAdapter
* @since v1-alpha2
*/
public class AnsiLoggerImplementation implements LoggerImplementation {
public class AnsiLoggingAdapter implements LoggingAdapter {
/**
* Constructs this class.
*
* @since v1-alpha2
*/
public AnsiLoggerImplementation() {}
public AnsiLoggingAdapter() {}
/** {@inheritDoc} */
@Override

View file

@ -19,7 +19,7 @@
package de.staropensource.sosengine.ansi;
import de.staropensource.sosengine.base.implementable.ShortcodeParserSkeleton;
import de.staropensource.sosengine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.exception.ParserException;
import org.fusesource.jansi.Ansi;
import org.jetbrains.annotations.NotNull;
@ -30,10 +30,10 @@ import java.util.Set;
/**
* Converts shortcodes such as {@code <bold>} or {@code <blink>} into a usable {@link Ansi} escape sequence.
*
* @see ShortcodeParserSkeleton
* @see ShortcodeParser
* @since v1-alpha2
*/
public final class AnsiShortcodeConverter extends ShortcodeParserSkeleton {
public final class AnsiShortcodeConverter extends ShortcodeParser {
/**
* Constructs this class.
*

View file

@ -71,7 +71,7 @@ public final class AnsiSubsystem extends SubsystemClass {
/** {@inheritDoc} */
@Override
public void initializeSubsystem() {
Logger.setLoggerImplementation(new AnsiLoggerImplementation());
Logger.setLoggerImplementation(new AnsiLoggingAdapter());
}
/** {@inheritDoc} */

View file

@ -432,14 +432,14 @@ public final class Engine extends SubsystemClass {
logger.verb("Initializing engine subsystems");
long initTime;
for (DependencySubsystemVector vector : subsystems) {
logger.diag("Initializing subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + ")");
logger.diag("Initializing subsystem " + vector.getSubsystemClass().getName() + " (" + vector.getSubsystemClass().getClass().getName() + ")");
try {
initTime = Miscellaneous.measureExecutionTime(() -> vector.getMainClass().initializeSubsystem());
initTime = Miscellaneous.measureExecutionTime(() -> vector.getSubsystemClass().initializeSubsystem());
} catch (Throwable throwable) {
logger.crash("An error occurred trying to initialize subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + "): " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
logger.crash("An error occurred trying to initialize subsystem " + vector.getSubsystemClass().getName() + " (" + vector.getSubsystemClass().getClass().getName() + "): " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
throw throwable;
}
logger.diag("Initialized subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + ") in " + initTime + "ms");
logger.diag("Initialized subsystem " + vector.getSubsystemClass().getName() + " (" + vector.getSubsystemClass().getClass().getName() + ") in " + initTime + "ms");
}
// Update 'subsystems'

View file

@ -19,7 +19,7 @@
package de.staropensource.sosengine.base;
import de.staropensource.sosengine.base.implementable.ShortcodeParserSkeleton;
import de.staropensource.sosengine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.implementable.Configuration;
import de.staropensource.sosengine.base.implementable.helper.EventHelper;
import de.staropensource.sosengine.base.logging.CrashHandler;
@ -107,10 +107,10 @@ public final class EngineConfiguration extends Configuration {
private boolean debugEvents;
/**
* If enabled, very verbose messages about the {@link ShortcodeParserSkeleton}'s internals will be printed.
* If enabled, very verbose messages about the {@link ShortcodeParser}'s internals will be printed.
* Don't enable unless you want to work on it.
*
* @see ShortcodeParserSkeleton
* @see ShortcodeParser
* @since v1-alpha0
* -- GETTER --
* Gets the value for {@link #debugShortcodeConverter}.
@ -122,10 +122,10 @@ public final class EngineConfiguration extends Configuration {
private boolean debugShortcodeConverter;
/**
* If enabled, invalid shortcodes will be logged by the {@link ShortcodeParserSkeleton}.
* If enabled, invalid shortcodes will be logged by the {@link ShortcodeParser}.
* The message will be printed as a {@link LogLevel#SILENT_WARNING}.
*
* @see ShortcodeParserSkeleton
* @see ShortcodeParser
* @see #loggerLevel
* @since v1-alpha0
* -- GETTER --

View file

@ -27,10 +27,10 @@ import org.jetbrains.annotations.Nullable;
/**
* Interface for implementing custom logger implementations.
*
* @see Logger#setLoggerImplementation(LoggerImplementation)
* @see Logger#setLoggerImplementation(LoggingAdapter)
* @since v1-alpha0
*/
public interface LoggerImplementation {
public interface LoggingAdapter {
/**
* Invoked before anything is done with the log message.
*

View file

@ -49,7 +49,7 @@ import java.util.Locale;
* @since v1-alpha1
*/
@SuppressWarnings({ "JavadocDeclaration" })
public abstract class ShortcodeParserSkeleton {
public abstract class ShortcodeParser {
/**
* Contains the {@link LoggerInstance} for this instance.
*
@ -79,7 +79,7 @@ public abstract class ShortcodeParserSkeleton {
* @throws ParserException on error
* @since v1-alpha2
*/
public ShortcodeParserSkeleton(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
public ShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
components = parse(string, ignoreInvalidEscapes);
}

View file

@ -20,7 +20,7 @@
package de.staropensource.sosengine.base.implementation.logging;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggerImplementation;
import de.staropensource.sosengine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.logging.Logger;
import de.staropensource.sosengine.base.type.logging.LogLevel;
import de.staropensource.sosengine.base.implementation.shortcode.EmptyShortcodeConverter;
@ -31,16 +31,16 @@ import org.jetbrains.annotations.Nullable;
* Prints log messages to the console, without any fancy colors or formatting.
*
* @see Logger
* @see LoggerImplementation
* @see LoggingAdapter
* @since v1-alpha1
*/
public class PlainLoggerImplementation implements LoggerImplementation {
public class PlainLoggingAdapter implements LoggingAdapter {
/**
* Constructs this class.
*
* @since v1-alpha1
*/
public PlainLoggerImplementation() {}
public PlainLoggingAdapter() {}
/** {@inheritDoc} */
@Override

View file

@ -19,24 +19,24 @@
package de.staropensource.sosengine.base.implementation.logging;
import de.staropensource.sosengine.base.implementable.LoggerImplementation;
import de.staropensource.sosengine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* An implementation of {@link LoggerImplementation}, which does nothing.
* An implementation of {@link LoggingAdapter}, which does nothing.
* Useful if you want to silence engine startup messages.
*
* @since v1-alpha4
*/
public class QuietLoggerImplementation implements LoggerImplementation {
public class QuietLoggingAdapter implements LoggingAdapter {
/**
* Constructs this class.
*
* @since v1-alpha4
*/
public QuietLoggerImplementation() {}
public QuietLoggingAdapter() {}
/** {@inheritDoc} */
@Override

View file

@ -20,7 +20,7 @@
package de.staropensource.sosengine.base.implementation.logging;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggerImplementation;
import de.staropensource.sosengine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.logging.Logger;
import de.staropensource.sosengine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull;
@ -31,16 +31,16 @@ import org.jetbrains.annotations.Nullable;
* Will reveal shortcodes as they will not be replaced.
*
* @see Logger
* @see LoggerImplementation
* @see LoggingAdapter
* @since v1-alpha1
*/
public class RawLoggerImplementation implements LoggerImplementation {
public class RawLoggingAdapter implements LoggingAdapter {
/**
* Constructs this class.
*
* @since v1-alpha1
*/
public RawLoggerImplementation() {}
public RawLoggingAdapter() {}
/** {@inheritDoc} */
@Override

View file

@ -18,7 +18,7 @@
*/
/**
* A set of built-in {@link de.staropensource.sosengine.base.implementable.LoggerImplementation}s.
* A set of built-in {@link de.staropensource.sosengine.base.implementable.LoggingAdapter}s.
*
* @since v1-alpha1
*/

View file

@ -19,17 +19,17 @@
package de.staropensource.sosengine.base.implementation.shortcode;
import de.staropensource.sosengine.base.implementable.ShortcodeParserSkeleton;
import de.staropensource.sosengine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.exception.ParserException;
import org.jetbrains.annotations.NotNull;
/**
* Cleans the string of any tags.
*
* @see ShortcodeParserSkeleton
* @see ShortcodeParser
* @since v1-alpha1
*/
public final class EmptyShortcodeConverter extends ShortcodeParserSkeleton {
public final class EmptyShortcodeConverter extends ShortcodeParser {
/**
* Constructs this class.
*

View file

@ -48,18 +48,18 @@ public final class DependencySubsystemVector extends DependencyVector {
* @return associated {@link SubsystemClass}
* @since v1-alpha1
*/
private final SubsystemClass mainClass;
private final SubsystemClass subsystemClass;
/**
* Reuses an existing {@link DependencyVector} to create a new {@link DependencySubsystemVector}.
*
* @param vector existing dependency vector to reuse
* @param mainClass {@link SubsystemClass} to associate
* @param vector existing dependency vector to reuse
* @param subsystemClass {@link SubsystemClass} to associate
* @since v1-alpha1
*/
public DependencySubsystemVector(@NotNull DependencyVector vector, @NotNull SubsystemClass mainClass) {
super(mainClass.getName(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies(), vector.getProvides());
this.mainClass = mainClass;
public DependencySubsystemVector(@NotNull DependencyVector vector, @NotNull SubsystemClass subsystemClass) {
super(subsystemClass.getName(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies(), vector.getProvides());
this.subsystemClass = subsystemClass;
}
/**
@ -69,12 +69,12 @@ public final class DependencySubsystemVector extends DependencyVector {
* @param version version
* @param dependencies dependencies in the usual format ({@code dependencyA}, {@code dependencyB=5.1}, {@code dependencyC>3.1}, {@code dependencyD<6.1}, {@code dependencyE>5.3<5.4})
* @param provides vectors this vector provides, in the usual format ({@code identifier=version})
* @param mainClass {@link SubsystemClass} to associate
* @param subsystemClass {@link SubsystemClass} to associate
* @since v1-alpha1
*/
public DependencySubsystemVector(@NotNull Class<? extends VersioningSystem> versioningSystem, @NotNull String version, @NotNull Set<@NotNull String> dependencies, @NotNull Set<@NotNull String> provides, @NotNull SubsystemClass mainClass) {
super(mainClass.getName(), versioningSystem, version, dependencies, provides);
this.mainClass = mainClass;
public DependencySubsystemVector(@NotNull Class<? extends VersioningSystem> versioningSystem, @NotNull String version, @NotNull Set<@NotNull String> dependencies, @NotNull Set<@NotNull String> provides, @NotNull SubsystemClass subsystemClass) {
super(subsystemClass.getName(), versioningSystem, version, dependencies, provides);
this.subsystemClass = subsystemClass;
}
/**
@ -93,10 +93,10 @@ public final class DependencySubsystemVector extends DependencyVector {
/**
* Contains the {@link SubsystemClass} to associate.
*
* @see DependencySubsystemVector#mainClass
* @see DependencySubsystemVector#subsystemClass
* @since v1-alpha4
*/
private @Nullable SubsystemClass mainClass;
private @Nullable SubsystemClass subsystemClass;
/**
* {@inheritDoc}
@ -125,7 +125,7 @@ public final class DependencySubsystemVector extends DependencyVector {
setDefaults();
//noinspection DataFlowIssue // IDE is dumb
return new DependencySubsystemVector(getVersioningSystem(), getVersion(), getDependencies(), getProvides(), mainClass);
return new DependencySubsystemVector(getVersioningSystem(), getVersion(), getDependencies(), getProvides(), subsystemClass);
}
/** {@inheritDoc} */
@ -133,7 +133,7 @@ public final class DependencySubsystemVector extends DependencyVector {
protected void checkRequiredFields() throws IllegalStateException {
super.checkRequiredFields();
if (mainClass == null)
if (subsystemClass == null)
throw new IllegalStateException("The main class is unset");
}
@ -141,23 +141,23 @@ public final class DependencySubsystemVector extends DependencyVector {
* Returns the {@link SubsystemClass} to associate.
*
* @return {@link SubsystemClass} to associcate
* @see DependencySubsystemVector#mainClass
* @see DependencySubsystemVector#subsystemClass
* @since v1-alpha4
*/
public @Nullable SubsystemClass getMainClass() {
return mainClass;
public @Nullable SubsystemClass getSubsystemClass() {
return subsystemClass;
}
/**
* Sets the {@link SubsystemClass} to associate.
*
* @param mainClass new {@link SubsystemClass} to associate
* @param subsystemClass new {@link SubsystemClass} to associate
* @return builder instance
* @see DependencySubsystemVector#mainClass
* @see DependencySubsystemVector#subsystemClass
* @since v1-alpha4
*/
public @NotNull DependencyVector.Builder setIdentifier(@Nullable SubsystemClass mainClass) {
this.mainClass = mainClass;
public @NotNull DependencyVector.Builder setIdentifier(@Nullable SubsystemClass subsystemClass) {
this.subsystemClass = subsystemClass;
return this;
}
}

View file

@ -21,12 +21,12 @@ package de.staropensource.sosengine.base.logging;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggerImplementation;
import de.staropensource.sosengine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.implementable.helper.EventHelper;
import de.staropensource.sosengine.base.event.LogEvent;
import de.staropensource.sosengine.base.internal.implementation.placeholder.logger.*;
import de.staropensource.sosengine.base.internal.type.QueuedLogMessage;
import de.staropensource.sosengine.base.implementation.logging.PlainLoggerImplementation;
import de.staropensource.sosengine.base.implementation.logging.PlainLoggingAdapter;
import de.staropensource.sosengine.base.type.EngineState;
import de.staropensource.sosengine.base.type.logging.LogLevel;
import de.staropensource.sosengine.base.type.logging.LogRule;
@ -75,26 +75,26 @@ public final class Logger {
private static final LinkedList<QueuedLogMessage> queuedMessages = new LinkedList<>();
/**
* Refers to the active {@link LoggerImplementation} that is used to process and print log messages.
* Refers to the active {@link LoggingAdapter} that is used to process and print log messages.
*
* @see LoggerImplementation
* @see LoggingAdapter
* @since v1-alpha0
* -- GETTER --
* Returns the active {@link LoggerImplementation}.
* Returns the active {@link LoggingAdapter}.
*
* @return active {@link LoggerImplementation}
* @see LoggerImplementation
* @return active {@link LoggingAdapter}
* @see LoggingAdapter
* @since v1-alpha0
* -- SETTER --
* Sets the active {@link LoggerImplementation}.
* Sets the active {@link LoggingAdapter}.
*
* @param loggerImplementation new active {@link LoggerImplementation}
* @see LoggerImplementation
* @param loggerImplementation new active {@link LoggingAdapter}
* @see LoggingAdapter
* @since v1-alpha0
*/
@Getter
@Setter
private static @NotNull LoggerImplementation loggerImplementation = new PlainLoggerImplementation();
private static @NotNull LoggingAdapter loggerImplementation = new PlainLoggingAdapter();
/**
* Contains all active {@link LogRule}s.