Add annotation and new method for subsystems
This commit is contained in:
parent
4793d7aefe
commit
aa5b196fb3
6 changed files with 70 additions and 0 deletions
|
@ -19,10 +19,12 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base;
|
package de.staropensource.sosengine.base;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.events.EngineCrashEvent;
|
import de.staropensource.sosengine.base.events.EngineCrashEvent;
|
||||||
import de.staropensource.sosengine.base.events.EngineShutdownEvent;
|
import de.staropensource.sosengine.base.events.EngineShutdownEvent;
|
||||||
import de.staropensource.sosengine.base.events.LogEvent;
|
import de.staropensource.sosengine.base.events.LogEvent;
|
||||||
|
@ -49,6 +51,7 @@ import java.util.Map;
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||||
|
@EngineSubsystem
|
||||||
public final class Engine implements SubsystemMainClass {
|
public final class Engine implements SubsystemMainClass {
|
||||||
/**
|
/**
|
||||||
* Instance.
|
* Instance.
|
||||||
|
@ -74,6 +77,20 @@ public final class Engine implements SubsystemMainClass {
|
||||||
@NotNull
|
@NotNull
|
||||||
private LoggerInstance logger;
|
private LoggerInstance logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains a list of all registered subsystems.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Returns a list of all registered subsystems.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@Getter
|
||||||
|
private ImmutableMap<@NotNull Class<? extends SubsystemMainClass>, @NotNull DependencyVector> subsystems = new ImmutableMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the engine is shutting down.
|
* Indicates if the engine is shutting down.
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,6 +23,7 @@ import de.staropensource.sosengine.base.Engine;
|
||||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||||
import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent;
|
import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface for engine subsystem main classes.
|
* The interface for engine subsystem main classes.
|
||||||
|
@ -39,6 +40,14 @@ public interface SubsystemMainClass {
|
||||||
*/
|
*/
|
||||||
LoggerInstance logger = null;
|
LoggerInstance logger = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link DependencyVector} for this subsystem.
|
||||||
|
*
|
||||||
|
* @see DependencyVector
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
DependencyVector getDependencyVector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the engine shuts down.
|
* Called when the engine shuts down.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,12 +19,16 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.graphics.opengl;
|
package de.staropensource.sosengine.graphics.opengl;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
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.CodePart;
|
||||||
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
||||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||||
|
@ -43,6 +47,7 @@ import static org.lwjgl.glfw.GLFW.*;
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||||
|
@EngineSubsystem
|
||||||
public final class OpenGlSubsystem implements ApiMainClass {
|
public final class OpenGlSubsystem implements ApiMainClass {
|
||||||
/**
|
/**
|
||||||
* Instance.
|
* Instance.
|
||||||
|
@ -187,4 +192,10 @@ public final class OpenGlSubsystem implements ApiMainClass {
|
||||||
|
|
||||||
logger.info("Shut down in " + shutdownTime + "ms");
|
logger.info("Shut down in " + shutdownTime + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public DependencyVector getDependencyVector() {
|
||||||
|
return new DependencyVector("opengl", StarOpenSourceVersioningSystem.class, EngineInformation.getInstance().getVersioningString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,18 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.graphics;
|
package de.staropensource.sosengine.graphics;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
||||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent;
|
import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent;
|
||||||
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.CodePart;
|
||||||
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.utility.ListFormatter;
|
import de.staropensource.sosengine.base.utility.ListFormatter;
|
||||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||||
|
@ -46,6 +50,7 @@ import java.util.Map;
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||||
|
@EngineSubsystem
|
||||||
public final class GraphicsSubsystem implements SubsystemMainClass {
|
public final class GraphicsSubsystem implements SubsystemMainClass {
|
||||||
/**
|
/**
|
||||||
* Instance.
|
* Instance.
|
||||||
|
@ -140,6 +145,12 @@ public final class GraphicsSubsystem implements SubsystemMainClass {
|
||||||
EventHelper.precomputeEventListeners(GraphicsErrorEvent.class);
|
EventHelper.precomputeEventListeners(GraphicsErrorEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public DependencyVector getDependencyVector() {
|
||||||
|
return new DependencyVector("graphics", StarOpenSourceVersioningSystem.class, EngineInformation.getInstance().getVersioningString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts the subsystem down.
|
* Shuts the subsystem down.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,11 +19,15 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.graphics.vulkan;
|
package de.staropensource.sosengine.graphics.vulkan;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
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.CodePart;
|
||||||
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
||||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||||
|
@ -40,6 +44,7 @@ import static org.lwjgl.glfw.GLFW.*;
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||||
|
@EngineSubsystem
|
||||||
public final class VulkanSubsystem implements ApiMainClass {
|
public final class VulkanSubsystem implements ApiMainClass {
|
||||||
/**
|
/**
|
||||||
* Instance.
|
* Instance.
|
||||||
|
@ -162,4 +167,10 @@ public final class VulkanSubsystem implements ApiMainClass {
|
||||||
|
|
||||||
logger.info("Shut down in " + shutdownTime + "ms");
|
logger.info("Shut down in " + shutdownTime + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public DependencyVector getDependencyVector() {
|
||||||
|
return new DependencyVector("vulkan", StarOpenSourceVersioningSystem.class, EngineInformation.getInstance().getVersioningString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,15 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.slf4j_compat;
|
package de.staropensource.sosengine.slf4j_compat;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.events.LogEvent;
|
import de.staropensource.sosengine.base.events.LogEvent;
|
||||||
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.CodePart;
|
||||||
|
import de.staropensource.sosengine.base.types.DependencyVector;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -34,6 +38,7 @@ import org.slf4j.LoggerFactory;
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||||
|
@EngineSubsystem
|
||||||
public class Slf4jCompatibilitySubsystem implements SubsystemMainClass {
|
public class Slf4jCompatibilitySubsystem implements SubsystemMainClass {
|
||||||
/**
|
/**
|
||||||
* Instance.
|
* Instance.
|
||||||
|
@ -67,4 +72,10 @@ public class Slf4jCompatibilitySubsystem implements SubsystemMainClass {
|
||||||
LoggerFactory.getLogger(CompatibilityLogger.class).debug("If you see this then the SLF4J Compatibility Subsystem is working!");
|
LoggerFactory.getLogger(CompatibilityLogger.class).debug("If you see this then the SLF4J Compatibility Subsystem is working!");
|
||||||
logger.info("Initialized subsystem");
|
logger.info("Initialized subsystem");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public DependencyVector getDependencyVector() {
|
||||||
|
return new DependencyVector("slf4j-compat", StarOpenSourceVersioningSystem.class, EngineInformation.getInstance().getVersioningString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue