Compare commits

...

106 commits

Author SHA1 Message Date
d71ff5db0d
Relocate + split rendering code -> separate class
Some checks failed
build-and-test / build (push) Failing after 1m57s
build-and-test / generate-javadoc (push) Failing after 2m2s
build-and-test / test (push) Failing after 2m2s
This should allow for more JIT optimizations
2024-11-25 02:52:55 +01:00
485b813853
Fix FPS calculation
Some checks failed
build-and-test / build (push) Failing after 1m51s
build-and-test / test (push) Failing after 1m57s
build-and-test / generate-javadoc (push) Failing after 2m5s
2024-11-25 02:29:00 +01:00
d6d890b259
Fix delta time and FPS count calculation
Some checks failed
build-and-test / build (push) Failing after 2m0s
build-and-test / generate-javadoc (push) Failing after 2m3s
build-and-test / test (push) Failing after 2m5s
2024-11-25 02:26:32 +01:00
2db14012f8
Remove all remaining traces of ImmutableHashMap
Some checks failed
build-and-test / build (push) Failing after 1m58s
build-and-test / test (push) Failing after 2m4s
build-and-test / generate-javadoc (push) Failing after 2m7s
2024-11-25 01:59:16 +01:00
7d15c5c73d
Cleanup rendering subsystem
Some checks failed
build-and-test / build (push) Failing after 2m4s
build-and-test / generate-javadoc (push) Failing after 2m5s
build-and-test / test (push) Failing after 2m6s
2024-11-25 01:47:00 +01:00
c89e65882c
Very experimental rendering subsystem changes
Some checks failed
build-and-test / build (push) Failing after 2m4s
build-and-test / test (push) Failing after 2m4s
build-and-test / generate-javadoc (push) Failing after 2m8s
2024-11-24 16:39:11 +01:00
45ec057457
Rename some Miscellaneous methods, add stacktraceAsStringRecursive
Some checks failed
build-and-test / build (push) Failing after 1m57s
build-and-test / generate-javadoc (push) Failing after 2m1s
build-and-test / test (push) Failing after 2m1s
2024-11-24 15:39:48 +01:00
c975c5adff
Update icon
Some checks failed
build-and-test / test (push) Failing after 1m56s
build-and-test / generate-javadoc (push) Failing after 2m11s
build-and-test / build (push) Failing after 2m13s
2024-11-24 13:28:28 +01:00
64f48a472f
Perform code maintenance
Please note that this commit may not fully compile as I'm currently working on a rendering subsystem rewrite.
2024-11-24 13:28:15 +01:00
8bd0896415
Ignore JVM segfault log files
Some checks failed
build-and-test / build (push) Failing after 59s
build-and-test / generate-javadoc (push) Failing after 1m31s
build-and-test / test (push) Successful in 1m37s
2024-11-10 20:56:52 +01:00
20580fb80b
Update documentation to reflect last commit 2024-11-10 20:56:35 +01:00
a45f010196
Merge and rename windowing subsystem 2024-11-10 20:55:01 +01:00
69cf668c4d
Heavily improve API doc of EngineConfiguration class
All checks were successful
build-and-test / test (push) Successful in 1m40s
build-and-test / generate-javadoc (push) Successful in 1m46s
build-and-test / build (push) Successful in 1m49s
2024-11-10 17:59:21 +01:00
7560e150af
Bump version
All checks were successful
build-and-test / test (push) Successful in 1m50s
build-and-test / build (push) Successful in 1m55s
build-and-test / generate-javadoc (push) Successful in 1m55s
2024-11-10 17:17:10 +01:00
b643735d0b
Update Docusaurus once again
All checks were successful
build-and-test / test (push) Successful in 1m18s
build-and-test / generate-javadoc (push) Successful in 1m22s
build-and-test / build (push) Successful in 1m24s
2024-11-09 16:16:34 +01:00
d12206b925
Update dependencies, set source version to Java 21
All checks were successful
build-and-test / test (push) Successful in 1m26s
build-and-test / generate-javadoc (push) Successful in 1m32s
build-and-test / build (push) Successful in 1m34s
2024-11-09 15:51:39 +01:00
dde8972feb
Remove unused logTemplate config setting
All checks were successful
build-and-test / test (push) Successful in 1m4s
build-and-test / build (push) Successful in 1m15s
build-and-test / generate-javadoc (push) Successful in 1m21s
2024-11-09 14:37:32 +01:00
6425442c25
Update documentation
All checks were successful
build-and-test / test (push) Successful in 1m2s
build-and-test / build (push) Successful in 1m21s
build-and-test / generate-javadoc (push) Successful in 1m20s
2024-11-08 22:15:25 +01:00
d1d8e305ed
Fix build.gradle log call
All checks were successful
build-and-test / build (push) Successful in 1m17s
build-and-test / test (push) Successful in 1m27s
build-and-test / generate-javadoc (push) Successful in 1m34s
2024-11-06 14:29:31 +01:00
a6a41f5cec
Update docusaurus
Some checks failed
build-and-test / generate-javadoc (push) Failing after 59s
build-and-test / test (push) Successful in 1m48s
build-and-test / build (push) Successful in 1m52s
2024-11-06 02:31:45 +01:00
7cf9a4f418
Remove all old shortcode converter references
Some checks failed
build-and-test / test (push) Successful in 1m17s
build-and-test / build (push) Successful in 1m47s
build-and-test / generate-javadoc (push) Failing after 1m45s
2024-11-05 21:16:42 +01:00
ea93d12151
Move the very internal shutdown event to the non-internal events package
Some checks failed
build-and-test / build (push) Has been cancelled
build-and-test / generate-javadoc (push) Has been cancelled
build-and-test / test (push) Has been cancelled
2024-11-05 21:15:30 +01:00
c533a06148
Overhaul engine init procedure + add new placeholder
Some checks failed
build-and-test / build (push) Successful in 1m17s
build-and-test / generate-javadoc (push) Failing after 1m21s
build-and-test / test (push) Successful in 1m30s
2024-11-05 21:13:30 +01:00
4281f946be
Fix Javadoc generation issues
Some checks failed
build-and-test / generate-javadoc (push) Failing after 1m4s
build-and-test / build (push) Successful in 1m16s
build-and-test / test (push) Successful in 1m15s
2024-11-05 03:07:34 +01:00
5021f2cc35
Remove testing Logger#crash call
Some checks failed
build-and-test / build (push) Failing after 46s
build-and-test / test (push) Failing after 53s
build-and-test / generate-javadoc (push) Failing after 1m4s
2024-11-05 02:57:52 +01:00
edd28bef2f
Make getArguments return an immutable list
Some checks failed
build-and-test / test (push) Failing after 58s
build-and-test / generate-javadoc (push) Failing after 1m0s
build-and-test / build (push) Failing after 1m3s
2024-11-05 02:55:28 +01:00
7c0b7e1e90
Rewrite logging infrastructure
This commit changes the following things inside the logging infrastructure:
- passing issuerClass, issuerOrigin and issuerMetadata is no longer required, relevant information is now being pulled from the stack
- split huge classes into multiple smaller ones
- separated "normal" and asynchronous logging classes
- simplified logging
- improved performance
- more detailed crash reporting
- regex-based filtering
- internal placeholders have been replaced with more lightweight method calls
- much more changes
2024-11-05 02:54:50 +01:00
0966a43d5e
Fix Javadoc generation issues
All checks were successful
build-and-test / build (push) Successful in 1m4s
build-and-test / test (push) Successful in 1m16s
build-and-test / generate-javadoc (push) Successful in 1m22s
2024-11-03 18:54:27 +01:00
2730aa0f61
Add forced early engine init stage check
Some checks failed
build-and-test / build (push) Failing after 1m22s
build-and-test / test (push) Successful in 1m18s
build-and-test / generate-javadoc (push) Failing after 1m21s
2024-11-03 18:42:42 +01:00
ed1c8b9d3e
Add FileAccess class for filesystem access
Some checks failed
build-and-test / generate-javadoc (push) Failing after 1m18s
build-and-test / build (push) Failing after 1m22s
build-and-test / test (push) Successful in 1m30s
2024-11-03 18:40:48 +01:00
d3a01c2c66
Allow throwing all exceptions during engine init
Due to some Java limitation we are required to throw a RuntimeException with our original exception contained within and afterwards unwrap it so we can throw any exception we like. That is dumb.
2024-11-03 18:40:19 +01:00
a21ef1bc5f
Fix variable name convention 2024-11-03 18:32:40 +01:00
a619746e8d
Update abstract class constructor API doc 2024-10-30 22:32:03 +01:00
e42ac8a08e
Remove unecessary Window#render() call
All checks were successful
build-and-test / build (push) Successful in 1m7s
build-and-test / test (push) Successful in 1m27s
build-and-test / generate-javadoc (push) Successful in 1m30s
2024-10-18 17:58:03 +02:00
ffcf4604a4
Add setter docs for GlfwWindow#renderCode
All checks were successful
build-and-test / test (push) Successful in 1m8s
build-and-test / generate-javadoc (push) Successful in 1m40s
build-and-test / build (push) Successful in 1m43s
2024-10-18 17:51:00 +02:00
6f8d190d6f
Add ability to inject custom rendering code, open GLFW subsystem
Some checks failed
build-and-test / build (push) Failing after 1m18s
build-and-test / generate-javadoc (push) Failing after 1m18s
build-and-test / test (push) Successful in 1m24s
2024-10-18 16:24:10 +02:00
c2028cfa33
Add window hint to instruct GLFW to use no API
All checks were successful
build-and-test / build (push) Successful in 1m16s
build-and-test / test (push) Successful in 1m30s
build-and-test / generate-javadoc (push) Successful in 1m34s
2024-10-18 15:08:06 +02:00
40894bedba
Bump version 2024-10-16 13:43:46 +02:00
6d7701a7c3
Update GlfwWindow#setIcons logging
All checks were successful
build-and-test / generate-javadoc (push) Successful in 1m34s
build-and-test / test (push) Successful in 1m33s
build-and-test / build (push) Successful in 1m37s
2024-10-16 13:21:54 +02:00
665ea05041
Fix Window#setIcons issue 2024-10-16 13:21:32 +02:00
37ac235662
Update versions and links in documentation
Some checks are pending
build-and-test / generate-javadoc (push) Waiting to run
build-and-test / test (push) Waiting to run
build-and-test / build (push) Successful in 1m12s
2024-10-16 13:09:53 +02:00
01ea995177
Add missing package-info.java class
All checks were successful
build-and-test / build (push) Successful in 1m33s
build-and-test / test (push) Successful in 1m30s
build-and-test / generate-javadoc (push) Successful in 1m34s
2024-10-16 13:06:24 +02:00
294ec217ea
Correct package structure inside GLFW subsystem 2024-10-16 13:06:17 +02:00
4c9bfb3732
Bump version 2024-10-16 13:05:40 +02:00
f6c99b66e8
Fix debugFrames check and Window#icons type
All checks were successful
build-and-test / build (push) Successful in 1m12s
build-and-test / test (push) Successful in 1m25s
build-and-test / generate-javadoc (push) Successful in 1m29s
2024-10-16 13:03:19 +02:00
643bda6c28
Update maven repository URL
All checks were successful
build-and-test / test (push) Successful in 1m2s
build-and-test / build (push) Successful in 1m8s
build-and-test / generate-javadoc (push) Successful in 1m14s
2024-10-15 13:53:16 +02:00
281e7db708
Update documentation 2024-10-15 13:51:02 +02:00
2d558f8482
Update and add README.md files 2024-10-15 13:49:02 +02:00
0d5f19ee31
Rename and update errorShortcodeConverter setting
All checks were successful
build-and-test / test (push) Successful in 57s
build-and-test / build (push) Successful in 1m17s
build-and-test / generate-javadoc (push) Successful in 1m18s
2024-10-15 13:16:59 +02:00
8456e92a52
Fix EngineConfiguration test
All checks were successful
build-and-test / test (push) Successful in 1m15s
build-and-test / generate-javadoc (push) Successful in 1m31s
build-and-test / build (push) Successful in 1m33s
2024-10-15 04:07:08 +02:00
d0a68b22d2
Fix Javadoc documentation 2024-10-15 04:07:01 +02:00
2cf769b599
Fix LWJGL initialization error handling 2024-10-15 04:06:52 +02:00
25a944baf4
Fix null value crash 2024-10-15 04:06:31 +02:00
f4019455cc
Fix LWJGL native load error 2024-10-15 04:06:05 +02:00
cdde093b31
Update notification dismissal system a bit 2024-10-15 04:05:37 +02:00
8a52e991fd
Fixed LWJGL natives switch 2024-10-15 03:38:35 +02:00
6cd38377b2
Reorganize build scripts
Some checks failed
build-and-test / build (push) Failing after 37s
build-and-test / generate-javadoc (push) Failing after 39s
build-and-test / test (push) Failing after 44s
2024-10-15 03:36:50 +02:00
bed5811b70
Add notification subsystem
Some checks failed
build-and-test / generate-javadoc (push) Failing after 1m5s
build-and-test / test (push) Failing after 1m4s
build-and-test / build (push) Failing after 1m10s
2024-10-15 03:30:55 +02:00
1e6fa79716
Implement experimental window icon support 2024-10-15 03:30:49 +02:00
cdd68833cb
Fix double Engine initialization 2024-10-15 03:29:13 +02:00
175b0248d9
Fix Window.Builder#setMonitor visibility
Some checks failed
build-and-test / test (push) Failing after 1s
build-and-test / generate-javadoc (push) Failing after 4s
build-and-test / build (push) Failing after 15s
2024-10-14 16:08:44 +02:00
b3ef38b6be
Change type of Window#windows from Set to List 2024-10-14 16:08:29 +02:00
10e3b26ac0
Respect 'debugFrames' subsystem config option
Some checks failed
build-and-test / generate-javadoc (push) Failing after 58s
build-and-test / build (push) Failing after 1m4s
build-and-test / test (push) Has been cancelled
2024-10-14 16:02:35 +02:00
7a7da3729c
Respect a window's rendering flag state 2024-10-14 16:01:50 +02:00
2f0bc19e7c
Update/Fix engine init exception handling + errors
Some checks failed
build-and-test / generate-javadoc (push) Failing after 1m6s
build-and-test / build (push) Failing after 1m11s
build-and-test / test (push) Has been cancelled
2024-10-14 15:48:54 +02:00
9d19dd8b57
Remove ShortcodeParser debug logging 2024-10-14 15:47:56 +02:00
bd05235af9
'final'ize 'testing' classes
Some checks failed
build-and-test / test (push) Successful in 1m41s
build-and-test / generate-javadoc (push) Failing after 1m44s
build-and-test / build (push) Failing after 1m56s
2024-10-07 01:32:23 +02:00
a0fdfd2722
Fix TestBase engine initialization 2024-10-07 01:32:05 +02:00
a77794b105
Update gradle wrapper
Some checks failed
build-and-test / generate-javadoc (push) Failing after 3m18s
build-and-test / build (push) Failing after 3m21s
build-and-test / test (push) Failing after 3m18s
2024-10-03 21:38:01 +02:00
3bd6a26e59
Remove unused methods, finalize class
Some checks failed
build-and-test / build (push) Failing after 30s
build-and-test / test (push) Failing after 31s
build-and-test / generate-javadoc (push) Failing after 39s
2024-09-28 21:47:15 +02:00
5e829771a7
Rename LogLevel -> LogLevelEvent
The source code now looks better :)
2024-09-28 21:46:20 +02:00
9922c672f6
Encapsulate windowing.glfw.implementable package 2024-09-28 21:45:47 +02:00
0075b465cd
Update Javadoc and class constructors 2024-09-28 21:45:09 +02:00
46b52173fd
Remove HSV from Color class description
Some checks failed
build-and-test / build (push) Failing after 28s
build-and-test / generate-javadoc (push) Failing after 31s
build-and-test / test (push) Successful in 49s
2024-09-28 17:54:06 +02:00
26294b3fa0
Add Color class
Some checks failed
build-and-test / build (push) Failing after 30s
build-and-test / generate-javadoc (push) Failing after 46s
build-and-test / test (push) Successful in 49s
2024-09-28 17:08:35 +02:00
f81d27060a
Add 4D vectors 2024-09-28 17:08:27 +02:00
dd4ebcd88a
Mark all arrays as @NotNull
Some checks failed
build-and-test / build (push) Failing after 46s
build-and-test / generate-javadoc (push) Failing after 44s
build-and-test / test (push) Successful in 58s
2024-09-28 16:59:45 +02:00
02aa744098
Rename de.staropensource.sosengine package
All checks were successful
build-and-test / test (push) Successful in 1m4s
build-and-test / build (push) Successful in 1m21s
build-and-test / generate-javadoc (push) Successful in 1m27s
2024-09-27 23:16:25 +02:00
a4224f9c51
Fix copyright notice copyright attribution
Some checks failed
build-and-test / generate-javadoc (push) Has been cancelled
build-and-test / build (push) Has been cancelled
build-and-test / test (push) Has been cancelled
2024-09-27 23:02:16 +02:00
b68a7855dc
Fix development documentation link
All checks were successful
build-and-test / test (push) Successful in 1m57s
build-and-test / build (push) Successful in 2m9s
build-and-test / generate-javadoc (push) Successful in 2m27s
2024-09-22 14:20:17 +02:00
f1b3bb5b88
Bump version and add v1-alpha5 API doc links
All checks were successful
build-and-test / test (push) Successful in 1m24s
build-and-test / build (push) Successful in 1m30s
build-and-test / generate-javadoc (push) Successful in 1m39s
2024-09-22 14:08:58 +02:00
38d8deefa7
Fix @since tags
All checks were successful
build-and-test / test (push) Successful in 1m30s
build-and-test / build (push) Successful in 1m36s
build-and-test / generate-javadoc (push) Successful in 1m35s
2024-09-22 13:48:33 +02:00
b26517958a
Add "-Xlog:gc" flag
All checks were successful
build-and-test / test (push) Successful in 1m27s
build-and-test / generate-javadoc (push) Successful in 1m43s
build-and-test / build (push) Successful in 1m45s
2024-09-22 13:40:48 +02:00
b675a5ffb2
[noci] Change wording in Substrate VM error message 2024-09-21 21:09:24 +02:00
796eb9c8f9
Fix Javadoc API generation warnings and errors
All checks were successful
build-and-test / build (push) Successful in 1m27s
build-and-test / test (push) Successful in 1m23s
build-and-test / generate-javadoc (push) Successful in 1m36s
2024-09-21 21:01:57 +02:00
a9125c9bea
How did this get into the code? 2024-09-21 20:48:03 +02:00
3d3f21e217
Rename setting 'optimizeSubsystemInitialization'
Some checks failed
build-and-test / build (push) Failing after 1m7s
build-and-test / generate-javadoc (push) Failing after 1m6s
build-and-test / test (push) Successful in 1m24s
2024-09-21 17:24:27 +02:00
a00fdea6f5
Add initialization error when running in Substrate VM 2024-09-21 17:22:17 +02:00
0fed87328a
Shorten width of variable descriptions 2024-09-21 17:21:17 +02:00
0fbfe8f4e3
Add support for disabling classpath scanning
This commit however does not implement support for Substrate VM/native-image,
which I've already tested. Sad.
2024-09-21 17:20:14 +02:00
ebbc1778ae
Fix crashes not shutting down engine 2024-09-21 17:09:42 +02:00
a9cfc8c810
Add static Tristate#toTristate method 2024-09-21 17:08:59 +02:00
45f02bdd5a
Add de.staropensource.sosengine.dynamic package 2024-09-21 17:08:41 +02:00
a3ea583e41
Switch implementation dependencies to runtimeOnly 2024-09-21 17:08:18 +02:00
c14e34cd81
Rename fix InvalidMethodSignatureException naming 2024-09-20 18:35:59 +02:00
c473c27298
Inline EventHelper#logCall
All checks were successful
build-and-test / test (push) Successful in 2m41s
build-and-test / build (push) Successful in 3m11s
build-and-test / generate-javadoc (push) Successful in 3m12s
2024-09-20 17:10:50 +02:00
54b7b9a695
Remove code duplication (returns in conf classes) 2024-09-20 17:10:33 +02:00
5766072fd7
Make Tristate#toBoolean no longer static
All checks were successful
build-and-test / test (push) Successful in 1m25s
build-and-test / build (push) Successful in 1m42s
build-and-test / generate-javadoc (push) Successful in 1m41s
2024-09-07 16:52:17 +02:00
b49ff9a569
Fix crash reporter exception (yes really) 2024-09-07 16:51:55 +02:00
f342555b8a
Update API documentation 2024-09-07 16:51:37 +02:00
9be753b4df
[no ci] Update module-info.java comments 2024-09-07 16:51:10 +02:00
f96584ccd9
'final'lize slf4j-compat classes
All checks were successful
build-and-test / test (push) Successful in 1m24s
build-and-test / build (push) Successful in 1m38s
build-and-test / generate-javadoc (push) Successful in 1m42s
2024-09-06 21:00:22 +02:00
a870cbe11b
Fix copyright replace regex
All checks were successful
build-and-test / test (push) Successful in 1m55s
build-and-test / build (push) Successful in 2m10s
build-and-test / generate-javadoc (push) Successful in 2m11s
2024-09-06 01:28:34 +02:00
dffd24d8bb
Add Javadoc files for testing subproject
All checks were successful
build-and-test / test (push) Successful in 1m47s
build-and-test / build (push) Successful in 1m54s
build-and-test / generate-javadoc (push) Successful in 1m56s
2024-09-05 02:03:59 +02:00
e9e57a732a
Add API documentation links for v1-alpha4
All checks were successful
build-and-test / build (push) Successful in 2m11s
build-and-test / test (push) Successful in 2m7s
build-and-test / generate-javadoc (push) Successful in 2m10s
2024-09-05 02:01:13 +02:00
6696dc5700
Bump to v1-alpha5
All checks were successful
build-and-test / test (push) Successful in 1m39s
build-and-test / build (push) Successful in 1m55s
build-and-test / generate-javadoc (push) Successful in 2m3s
2024-09-05 01:58:21 +02:00
345 changed files with 11447 additions and 10555 deletions

3
.gitignore vendored
View file

@ -42,3 +42,6 @@ bin/
### Mac OS ### ### Mac OS ###
.DS_Store .DS_Store
### Java ###
hs_err_pid*.log

View file

@ -1,6 +1,6 @@
<component name="CopyrightManager"> <component name="CopyrightManager">
<copyright> <copyright>
<option name="allowReplaceRegexp" value="Copyright .* The StarOpenSource Engine Contributors" /> <option name="allowReplaceRegexp" value="Copyright .* The StarOpenSource Engine Authors" />
<option name="notice" value="STAROPENSOURCE ENGINE SOURCE FILE&#10;Copyright (c) &amp;#36;today.year The StarOpenSource Engine Authors&#10;Licensed under the GNU Affero General Public License v3&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU Affero General Public License as&#10;published by the Free Software Foundation, either version 3 of the&#10;License, or (at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU Affero General Public License for more details.&#10;&#10;You should have received a copy of the GNU Affero General Public License&#10;along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;." /> <option name="notice" value="STAROPENSOURCE ENGINE SOURCE FILE&#10;Copyright (c) &amp;#36;today.year The StarOpenSource Engine Authors&#10;Licensed under the GNU Affero General Public License v3&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU Affero General Public License as&#10;published by the Free Software Foundation, either version 3 of the&#10;License, or (at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU Affero General Public License for more details.&#10;&#10;You should have received a copy of the GNU Affero General Public License&#10;along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
<option name="myName" value="sos!engine" /> <option name="myName" value="sos!engine" />
</copyright> </copyright>

View file

@ -72,6 +72,8 @@ To change them, simply append `-P<property>` or `-P<property>=<value>`, like thi
#### Parallelism #### Parallelism
Use the `jobs` property to control how many jobs will get executed simultaneously. Use the `jobs` property to control how many jobs will get executed simultaneously.
On Linux, specify `-Pjobs=$(nproc)`. Defaults to `8`. On Linux, specify `-Pjobs=$(nproc)`. Defaults to `8`.
#### Rendering
You can use the `renderingPlatform` property to control which rendering platform to initialize for.
#### JVM Home #### JVM Home
You can use the `graalHome` property to specify the `$JAVA_HOME` of your local GraalVM installation. You can use the `graalHome` property to specify the `$JAVA_HOME` of your local GraalVM installation.
Only used in the `nativeImage` task. Useful if you aren't using GraalVM as your primary JDK. Only used in the `nativeImage` task. Useful if you aren't using GraalVM as your primary JDK.

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors * Copyright (c) 2024 The StarOpenSource Engine Authors
* Licensed under the GNU Affero General Public License v3 * Licensed under the GNU Affero General Public License v3
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,6 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Plugins // Plugins
plugins { plugins {
id("java") id("java")
@ -23,9 +24,8 @@ plugins {
id("maven-publish") id("maven-publish")
} }
// Project dependencies // Dependencies
dependencies { dependencies {
// -> Runtime <-
// Lombok // Lombok
compileOnly("org.projectlombok:lombok:${dependencyLombok}") compileOnly("org.projectlombok:lombok:${dependencyLombok}")
annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
@ -33,36 +33,11 @@ dependencies {
// JetBrains Annotations // JetBrains Annotations
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// ANSI support // Jansi
implementation("org.fusesource.jansi:jansi:${dependencyJansi}") implementation("org.fusesource.jansi:jansi:${dependencyJansi}")
// Project // Project
implementation(project(":base")) implementation(project(":base"))
// -> Testing <-
// Jetbrains Annotations
testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// JUnit
testImplementation(platform("org.junit:junit-bom:${dependencyJunit}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
} }
// Javadoc configuration // Javadoc configuration
@ -88,26 +63,6 @@ javadoc {
} }
} }
// Unit testing configuration
test {
useJUnitPlatform()
// Pass test configuration to test VMs
Map<String, String> testConfiguration = new HashMap<>();
for (String property : project.properties.keySet())
if (property.startsWith("test."))
testConfiguration.put(property, project.properties.get(property).toString())
systemProperties(testConfiguration)
setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8)
setForkEvery(1)
setFailFast(true)
testLogging {
events("passed", "skipped", "failed")
}
}
// Include javadoc and source jar during publishing // Include javadoc and source jar during publishing
java { java {
withJavadocJar() withJavadocJar()
@ -120,7 +75,7 @@ publishing {
repositories { repositories {
maven { maven {
name = "staropensource" name = "staropensource"
url = uri("https://mvn.staropensource.de/sosengine") url = uri("https://mvn.staropensource.de/engine")
credentials(org.gradle.api.credentials.PasswordCredentials) credentials(org.gradle.api.credentials.PasswordCredentials)
authentication { authentication {
//noinspection GroovyAssignabilityCheck //noinspection GroovyAssignabilityCheck
@ -139,3 +94,19 @@ publishing {
} }
} }
} }
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
}

View file

@ -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.ansi; package de.staropensource.engine.ansi;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggingAdapter; import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.sosengine.base.type.logging.LogLevel; import de.staropensource.engine.base.type.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;
/** /**
* Prints colored log output using the Jansi library. * Prints colored log output using the Jansi library.
@ -37,34 +36,22 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class AnsiLoggingAdapter implements LoggingAdapter { public class AnsiLoggingAdapter implements LoggingAdapter {
/** /**
* Constructs this class. * Creates and initializes an instance of this class.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
public AnsiLoggingAdapter() {} public AnsiLoggingAdapter() {}
/** {@inheritDoc} */
@Override
public @NotNull String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
return format; // No modifications necessary
}
/** {@inheritDoc} */
@Override
public @NotNull String postPlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
return format; // No modifications necessary
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
@SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here @SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here
public void print(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) { public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
// Convert to Ansi // Convert to Ansi
Ansi output = new AnsiShortcodeConverter(format, true).getAnsi(); Ansi output = new AnsiShortcodeParser(format, true).getAnsi();
// Print message // Print message
if (level == LogLevel.ERROR || level == LogLevel.CRASH) if (level == LogLevel.ERROR || level == LogLevel.CRASH)
if (EngineConfiguration.getInstance().isLoggerForceStandardOutput()) if (EngineConfiguration.getInstance().isLogForceStandardOutput())
AnsiConsole.out().println(output); AnsiConsole.out().println(output);
else else
AnsiConsole.err().println(output); AnsiConsole.err().println(output);

View file

@ -17,10 +17,10 @@
* 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.ansi; package de.staropensource.engine.ansi;
import de.staropensource.sosengine.base.implementable.ShortcodeParser; import de.staropensource.engine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.exception.ParserException; import de.staropensource.engine.base.exception.ParserException;
import org.fusesource.jansi.Ansi; import org.fusesource.jansi.Ansi;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,21 +28,22 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
/** /**
* Converts shortcodes such as {@code <bold>} or {@code <blink>} into a usable {@link Ansi} escape sequence. * Implementation of the {@link ShortcodeParser} class
* with ANSI support using the Jansi library.
* *
* @see ShortcodeParser * @see ShortcodeParser
* @since v1-alpha2 * @since v1-alpha8
*/ */
public final class AnsiShortcodeConverter extends ShortcodeParser { public final class AnsiShortcodeParser extends ShortcodeParser {
/** /**
* Constructs this class. * Creates and initializes an instance of this class.
* *
* @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-alpha2 * @since v1-alpha2
*/ */
public AnsiShortcodeConverter(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException { public AnsiShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
super(string, ignoreInvalidEscapes); super(string, ignoreInvalidEscapes);
} }

View file

@ -17,19 +17,19 @@
* 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.ansi; package de.staropensource.engine.ansi;
import de.staropensource.sosengine.base.annotation.EngineSubsystem; import de.staropensource.engine.base.annotation.EngineSubsystem;
import de.staropensource.sosengine.base.implementable.SubsystemClass; import de.staropensource.engine.base.implementable.SubsystemClass;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import de.staropensource.sosengine.base.implementation.versioning.StarOpenSourceVersioningSystem; import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.sosengine.base.type.DependencyVector; import de.staropensource.engine.base.type.DependencyVector;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Main object for the ANSI Compatibility subsystem. * Main class of the ANSI Compatibility subsystem.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
@ -50,7 +50,7 @@ public final class AnsiSubsystem extends SubsystemClass {
private static AnsiSubsystem instance = null; private static AnsiSubsystem instance = null;
/** /**
* Constructs this subsystem. * Initializes this subsystem.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
@ -59,7 +59,7 @@ public final class AnsiSubsystem extends SubsystemClass {
if (instance == null) if (instance == null)
instance = this; instance = this;
else else
logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance"); Logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View file

@ -20,4 +20,4 @@
/** /**
* Contains the ANSI subsystem code. * Contains the ANSI subsystem code.
*/ */
package de.staropensource.sosengine.ansi; package de.staropensource.engine.ansi;

View file

@ -6,22 +6,18 @@
*/ */
module sosengine.ansi { module sosengine.ansi {
// Dependencies // Dependencies
// -> Java <- // -> Java
requires transitive java.management; requires transitive java.management;
// -> Engine
// -> Engine <-
requires transitive sosengine.base; requires transitive sosengine.base;
// -> Libraries
// -> Common stuff <-
requires transitive static lombok; requires transitive static lombok;
requires transitive org.jetbrains.annotations; requires transitive org.jetbrains.annotations;
// -> Subystem-specific dependencies <-
requires org.fusesource.jansi; requires org.fusesource.jansi;
// API access // API access
exports de.staropensource.sosengine.ansi; exports de.staropensource.engine.ansi;
// Reflection access // Reflection access
opens de.staropensource.sosengine.ansi; opens de.staropensource.engine.ansi;
} }

View file

@ -1,6 +1,6 @@
<!-- <!--
~ STAROPENSOURCE ENGINE SOURCE FILE ~ STAROPENSOURCE ENGINE SOURCE FILE
~ Copyright (c) 2024 The StarOpenSource Engine Contributors ~ Copyright (c) 2024 The StarOpenSource Engine Authors
~ Licensed under the GNU Affero General Public License v3 ~ Licensed under the GNU Affero General Public License v3
~ ~
~ This program is free software: you can redistribute it and/or modify ~ This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors * Copyright (c) 2024 The StarOpenSource Engine Authors
* Licensed under the GNU Affero General Public License v3 * Licensed under the GNU Affero General Public License v3
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -26,9 +26,9 @@ plugins {
id("maven-publish") id("maven-publish")
} }
// Project dependencies // Dependencies
dependencies { dependencies {
// -> Runtime <- // -> Runtime
// Lombok // Lombok
compileOnly("org.projectlombok:lombok:${dependencyLombok}") compileOnly("org.projectlombok:lombok:${dependencyLombok}")
annotationProcessor("org.projectlombok:lombok:${dependencyLombok}") annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
@ -39,7 +39,7 @@ dependencies {
// Reflections // Reflections
implementation("org.reflections:reflections:${dependencyReflections}") implementation("org.reflections:reflections:${dependencyReflections}")
// -> Testing <- // -> Testing
// Jetbrains Annotations // Jetbrains Annotations
testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
@ -48,65 +48,10 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// -> Project <- // Project
testImplementation(project(":testing")) testImplementation(project(":testing"))
} }
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
}
// Copy gradle.properties file
// for inclusion in final build
tasks.register("copyGradleProperties") {
doFirst {
File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties")
File source = file(project(":").projectDir.getPath() + "/gradle.properties")
target.delete()
Files.copy(source.toPath(), target.toPath())
}
outputs.upToDateWhen({ false }) // Force task execution
}
processResources.dependsOn(copyGradleProperties)
// Git properties configuration
// Allows us to embed git commit information in the engine build
gitProperties {
dotGitDirectory = file("${rootProject.rootDir}/.git")
failOnNoGitDirectory = false // Allow continuing if .git directory is missing for the few who use tarballs
extProperty = "gitProps"
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "UTC"
}
tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build
doLast {
File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties")
File source = file("${project.projectDir}/build/resources/main/git.properties")
target.delete()
source.renameTo(target)
}
outputs.upToDateWhen({ false }) // Force task execution
}
generateGitProperties.outputs.upToDateWhen({ false }) // Force task execution
processResources.dependsOn(writeGitProperties) // Ensure git.properties file is present
// Javadoc configuration // Javadoc configuration
javadoc { javadoc {
outputs.upToDateWhen { false } // Force task execution outputs.upToDateWhen { false } // Force task execution
@ -162,7 +107,7 @@ publishing {
repositories { repositories {
maven { maven {
name = "staropensource" name = "staropensource"
url = uri("https://mvn.staropensource.de/sosengine") url = uri("https://mvn.staropensource.de/engine")
credentials(org.gradle.api.credentials.PasswordCredentials) credentials(org.gradle.api.credentials.PasswordCredentials)
authentication { authentication {
//noinspection GroovyAssignabilityCheck //noinspection GroovyAssignabilityCheck
@ -181,3 +126,58 @@ publishing {
} }
} }
} }
// Copy gradle.properties file
// for inclusion in final build
tasks.register("copyGradleProperties") {
doFirst {
File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties")
File source = file(project(":").projectDir.getPath() + "/gradle.properties")
target.delete()
Files.copy(source.toPath(), target.toPath())
}
outputs.upToDateWhen({ false }) // Force task execution
}
processResources.dependsOn(copyGradleProperties)
// Git properties configuration
// Allows us to embed git commit information in the engine build
gitProperties {
dotGitDirectory = file("${rootProject.rootDir}/.git")
failOnNoGitDirectory = false // Allow continuing if .git directory is missing for the few who use tarballs
extProperty = "gitProps"
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "UTC"
}
tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build
doLast {
File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties")
File source = file("${project.projectDir}/build/resources/main/git.properties")
target.delete()
source.renameTo(target)
}
outputs.upToDateWhen({ false }) // Force task execution
}
generateGitProperties.outputs.upToDateWhen({ false }) // Force task execution
processResources.dependsOn(writeGitProperties) // Ensure git.properties file is present
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
}

View file

@ -0,0 +1,616 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base;
import de.staropensource.engine.base.annotation.EngineSubsystem;
import de.staropensource.engine.base.event.*;
import de.staropensource.engine.base.exception.IllegalAccessException;
import de.staropensource.engine.base.exception.dependency.UnmetDependenciesException;
import de.staropensource.engine.base.implementable.ShutdownHandler;
import de.staropensource.engine.base.implementable.SubsystemClass;
import de.staropensource.engine.base.implementable.helper.EventHelper;
import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.engine.base.event.InternalEngineShutdownEvent;
import de.staropensource.engine.base.internal.type.DependencySubsystemVector;
import de.staropensource.engine.base.logging.PrintStreamService;
import de.staropensource.engine.base.logging.*;
import de.staropensource.engine.base.logging.backend.async.LoggingQueue;
import de.staropensource.engine.base.logging.backend.async.LoggingThread;
import de.staropensource.engine.base.type.DependencyVector;
import de.staropensource.engine.base.type.EngineState;
import de.staropensource.engine.base.utility.DependencyResolver;
import de.staropensource.engine.base.utility.FileAccess;
import de.staropensource.engine.base.utility.misc.Miscellaneous;
import de.staropensource.engine.base.utility.PlaceholderEngine;
import de.staropensource.engine.base.utility.information.EngineInformation;
import de.staropensource.engine.base.utility.information.JvmInformation;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range;
import org.reflections.Reflections;
import org.reflections.scanners.Scanners;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import java.util.*;
/**
* Main class of the sos!engine.
*
* @see EngineConfiguration
* @since v1-alpha0
*/
@SuppressWarnings({ "JavadocDeclaration" })
public final class Engine extends SubsystemClass {
/**
* Contains the class instance.
*
* @since v1-alpha0
* -- GETTER --
* Returns the class instance.
*
* @return class instance unless {@link Engine} is uninitialized
* @since v1-alpha0
*/
@Getter
private static Engine instance = null;
/**
* Contains the thread group of the engine.
*
* @since v1-alpha2
* -- GETTER --
* Returns the thread group of the engine.
*
* @return engine thread group
* @since v1-alpha2
*/
@Getter
private static final ThreadGroup threadGroup = new ThreadGroup("sos!engine");
/**
* Contains the engine state.
*
* @since v1-alpha2
* -- GETTER --
* Returns the engine state.
*
* @return shutdown state
* @since v1-alpha2
*/
@Getter
private @NotNull EngineState state;
/**
* Contains a list of all registered subsystems.
* The list is sorted after initialization order.
*
* @since v1-alpha1
* -- GETTER --
* Returns a list of all registered subsystems.
* The list is sorted after initialization order.
*
* @return subsystem list
* @since v1-alpha1
*/
@Getter
private @NotNull List<@NotNull DependencySubsystemVector> subsystems = Collections.emptyList();
/**
* Contains the engine's shutdown handler.
* The shutdown handler is responsible for
* shutting down the JVM safely.
*
* @see ShutdownHandler
* @since v1-alpha2
* -- GETTER --
* Returns the engine's shutdown handler.
* The shutdown handler is responsible for
* shutting down the JVM safely.
*
* @return shutdown handler
* @see ShutdownHandler
* @since v1-alpha2
* -- SETTER --
* Sets the engine's shutdown handler.
* The shutdown handler is responsible for
* shutting down the JVM safely.
*
* @param shutdownHandler new shutdown handler
* @see ShutdownHandler
* @since v1-alpha2
*/
@Getter(value = AccessLevel.MODULE)
@Setter(value = AccessLevel.MODULE)
private @NotNull ShutdownHandler shutdownHandler = new Engine.JvmShutdownHandler();
/**
* Contains the JVM shutdown hook thread,
* which ensures that the engine is fully shut
* down before the JVM exits.
*
* @see EngineInternals#installSafetyShutdownHook(boolean)
* @since v1-alpha4
*/
@Getter(AccessLevel.MODULE)
private final @NotNull Thread safetyShutdownHook = Thread.ofPlatform()
.name("Engine shutdown thread")
.group(getThreadGroup())
.unstarted(() -> {
// Check if already shutting down
switch (state) {
case UNKNOWN, SHUTDOWN, CRASHED -> {
return;
}
}
// Print warning about shutdown
Logger.warn("Trying to shut down engine using shutdown hook.\nThis approach to shutting down the engine and JVM is NOT RECOMMENDED, please use Engine#shutdown() instead.");
// Shutdown
Engine.getInstance().shutdown();
// Print last message
Logger.warn("Engine successfully shut down using shutdown hook. PLEASE USE Engine#shutdown() INSTEAD OF System#exit() or Runtime#exit()!");
});
/**
* Initializes the StarOpenSource Engine.
*
* @throws RuntimeException for all exceptions thrown by this constructor
* @since v1-alpha8
*/
private Engine() throws RuntimeException {
try {
instance = this;
state = EngineState.EARLY_STARTUP;
// For measuring the initialization time
long initTimeEarly = System.currentTimeMillis();
long initTimeLate = initTimeEarly;
// Check for incompatible JVM implementations
checkJvmIncompatibilities();
// Display that the engine is initializing
Logger.verb("Initializing engine");
// Start the logging thread
Logger.diag("Starting logging infrastructure");
LoggingThread.startThread(false);
PrintStreamService.initializeStreams();
// Initialize EngineInternals
Logger.diag("Initializing EngineInternals class");
new EngineInternals();
// Load engine configuration
Logger.diag("Loading engine configuration");
new EngineConfiguration();
EngineConfiguration.getInstance().loadConfiguration();
// Load engine build information
Logger.diag("Loading engine build information");
EngineInformation.update();
// Check for reflective classpath scanning compatibility
checkReflectiveClasspathScanningCompatibility();
// Check for Java version incompatibilities
checkJavaVersion();
// Initialize PlaceholderEngine
Logger.diag("Initializing PlaceholderEngine");
PlaceholderEngine.initialize();
// Initialize static FileAccess instances
Logger.diag("Initializing static FileAccess instances");
FileAccess.initializeInstances();
// Install the safety shutdown hook
Logger.diag("Installing safety shutdown hook");
EngineInternals.getInstance().installSafetyShutdownHook(true);
// Cache events
Logger.diag("Caching event listeners");
cacheEvents();
// Complete early initialization stage
Logger.verb("Completing early initialization stage");
state = EngineState.STARTUP;
initTimeEarly = System.currentTimeMillis() - initTimeEarly;
// Perform automatic subsystem initialization
if (EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization()) {
// Collect all subsystems
Logger.diag("Collecting subsystems");
collectSubsystems();
// Initialize subsystems
try {
initializeSubsystems();
} catch (Exception exception) {
Logger.error("Subsystem dependency resolution failed");
}
}
// Complete late initialization stage
Logger.verb("Completing late initialization stage");
state = EngineState.RUNNING;
initTimeLate = System.currentTimeMillis() - initTimeLate;
// Print welcome message
Logger.info(
"""
Welcome to the StarOpenSource Engine "%engine_version_codename%" %engine_version%!
Running commit %engine_git_commit_id_long% (dirty %engine_git_dirty%).
Initialization took %init_time_total%ms (early %init_time_early%ms, late %init_time_late%ms).
Copyright (c) 2024 The StarOpenSource Engine Authors
Licensed under the GNU Affero General Public License v3"""
.replace("%init_time_total%", String.valueOf(initTimeEarly + initTimeLate))
.replace("%init_time_early%", String.valueOf(initTimeEarly))
.replace("%init_time_late%", String.valueOf(initTimeLate))
);
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
/**
* Initializes the StarOpenSource
* Engine, if it isn't already.
*
* @throws IllegalStateException when running in an incompatible environment
* @throws RuntimeException on engine initialization failure
* @since v1-alpha6
*/
public static void initialize() throws RuntimeException {
try {
if (instance == null)
new Engine();
} catch (RuntimeException exception) {
Logger.error("Engine initialization failed");
Logger.error(Miscellaneous.throwableHeader(exception.getCause()));
for (String line : Miscellaneous.stacktraceAsString(exception.getCause(), true).split("\n"))
Logger.error(line);
throw new RuntimeException("Engine initialization failed", exception.getCause());
}
}
/**
* Checks if the running JVM implementation is not supported by the engine.
*
* @since v1-alpha8
*/
private void checkJvmIncompatibilities() {
if (System.getProperties().getProperty("sosengine.base.allowUnsupportedJVMInitialization", "false").equals("true")) {
Logger.warn("Skipping JVM implementation incompatibilities check");
return;
}
// Substrate VM (GraalVM Community)
if (JvmInformation.getImplementationName().equals("Substrate VM") && JvmInformation.getImplementationVendor().equals("GraalVM Community")) {
Logger.error("##############################################################################################");
Logger.error("## Running in Substrate VM, which is the name of the JVM used by GraalVM native-image. ##");
Logger.error("## The StarOpenSource Engine does not support native-image as using reflection in a certain ##");
Logger.error("## way seems to cause the Substrate JVM to crash. Workarounds have failed. ##");
Logger.error("## This has already been noted in issue #3, which you can view here: ##");
Logger.error("## https://git.staropensource.de/StarOpenSource/Engine/issues/3 ##");
Logger.error("## ##");
Logger.error("## While this is sad, we unfortunately can't do anything against it unless we introduce ##");
Logger.error("## annoying and stupid changes into the engine, which we don't want to do. ##");
Logger.error("## ##");
Logger.error("## We're truly sorry for this inconvenience. The sos!engine will now terminate. ##");
Logger.error("##############################################################################################");
Runtime.getRuntime().exit(255);
}
}
/**
* Checks if reflective classpath scanning is supported.
*
* @since v1-alpha8
*/
private void checkReflectiveClasspathScanningCompatibility() {
// Check if reflective classpath scanning is supported
if (System.getProperties().getProperty("sosengine.base.considerEnvironmentUnfriendlyToClasspathScanning", "false").equals("true")) {
Logger.warn("Running in an classpath scanning-unfriendly environment, disabling classpath scanning support.");
Logger.warn("If shit doesn't work and is expected to be discovered by annotations, you'll need to");
Logger.warn("either register it first or have to update some engine configuration setting.");
Logger.warn("Please consult sos!engine's documentation for more information about this issue.");
EngineInternals.getInstance().overrideReflectiveClasspathScanning(false);
}
}
/**
* Checks and warns if the Java version of the
* running JVM is higher than the engine supports.
*
* @since v1-alpha8
*/
private void checkJavaVersion() {
if (JvmInformation.getJavaVersion() > EngineInformation.getJavaSource())
Logger.warn("The StarOpenSource Engine is running on an untested Java version.\nThings may not work as expected or features which can improve performance, stability, compatibility or ease of use may be missing.\nIf you encounter issues, try running a JVM implementing Java " + EngineInformation.getJavaSource());
}
/**
* Caches all base engine events.
*
* @since v1-alpha0
*/
private void cacheEvents() {
EventHelper.cacheEvent(EngineCrashEvent.class);
EventHelper.cacheEvent(EngineShutdownEvent.class);
EventHelper.cacheEvent(EngineSoftCrashEvent.class);
EventHelper.cacheEvent(InternalEngineShutdownEvent.class);
EventHelper.cacheEvent(LogEvent.class);
}
/**
* Collects all subsystems by their {@link EngineSubsystem} annotation.
*
* @since v1-alpha1
*/
private void collectSubsystems() {
ArrayList<@NotNull DependencySubsystemVector> subsystemsMutable = new ArrayList<>();
Object initializedClassRaw;
SubsystemClass initializedClass;
// Check and initialize all classes, get dependency vector and check version, then add to 'subsystemsMutable'
for (Class<?> clazz : getRawSubsystemClasses())
try {
// Create new instance
initializedClassRaw = clazz.getDeclaredConstructor().newInstance();
initializedClass = null;
// Check if class implements SubsystemMainClass
if (initializedClassRaw instanceof SubsystemClass)
initializedClass = (SubsystemClass) initializedClassRaw;
else
Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Does not implement " + SubsystemClass.class.getName());
//noinspection DataFlowIssue // the crash call will prevent a NullPointerException
subsystemsMutable.add(new DependencySubsystemVector(initializedClass.getDependencyVector(), initializedClass));
} catch (Exception exception) {
if (exception.getClass() == IllegalStateException.class && exception.getMessage().startsWith("The version string is invalid: "))
Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Invalid version string: " + exception.getMessage().replace("The version string is invalid: ", ""));
Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Method invocation error", exception);
}
// Update 'subsystems'
subsystems = Collections.unmodifiableList(subsystemsMutable);
}
/**
* Returns a list of classes which are potentially
* eligible for subsystem initialization.
*
* @return potential subsystem classes
* @since v1-alpha5
*/
private Set<@NotNull Class<?>> getRawSubsystemClasses() {
Set<@NotNull Class<?>> classes = new HashSet<>();
if (EngineInternals.getInstance().getReflectiveClasspathScanning()) {
// Scan entire classpath using the Reflections library
Reflections reflections = new Reflections(
new ConfigurationBuilder()
.setUrls(ClasspathHelper.forJavaClassPath())
.setScanners(Scanners.TypesAnnotated)
);
// Get annotated methods
classes = reflections.getTypesAnnotatedWith(EngineSubsystem.class);
} else
for (String path : EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses())
try {
Logger.diag("Resolving class " + path);
classes.add(Class.forName(path));
} catch (ClassNotFoundException exception) {
Logger.error("Failed loading subsystem class " + path + ": Class not found");
}
return classes;
}
/**
* Initializes all subsystems.
*
* @throws Exception exceptions thrown by the {@link DependencyResolver}
* @since v1-alpha1
*/
private void initializeSubsystems() throws Exception {
DependencyResolver resolver = new DependencyResolver();
LinkedList<DependencySubsystemVector> order = new LinkedList<>();
// Add vectors
resolver.addVector(getDependencyVector());
resolver.addVectors(subsystems);
// Resolve dependencies and get order
Logger.diag("Resolving subsystem dependencies");
try {
for (DependencyVector vector : resolver.resolve().getOrder()) // smol workaround
order.add((DependencySubsystemVector) vector);
} catch (Throwable throwable) {
if (throwable instanceof UnmetDependenciesException exception) {
List<@NotNull String> unmetDependencies = exception.getUnmetDependencies();
StringBuilder list = new StringBuilder();
for (String error : unmetDependencies)
list
.append("\n")
.append("- ")
.append(error);
Logger.crash("Found unresolved dependencies:" + list, throwable);
return;
}
Logger.crash("An error occurred trying to resolve subsystem dependencies: " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
throw throwable;
}
// Initialize subsystems
Logger.diag("Initializing engine subsystems");
long initTime;
for (DependencySubsystemVector vector : subsystems) {
Logger.diag("Initializing subsystem '" + vector.getSubsystemClass().getName() + "' (" + vector.getSubsystemClass().getClass().getName() + ")");
try {
initTime = Miscellaneous.measureExecutionTime(() -> vector.getSubsystemClass().initializeSubsystem());
} catch (Throwable throwable) {
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.getSubsystemClass().getName() + "' (" + vector.getSubsystemClass().getClass().getName() + ") in " + initTime + "ms");
}
// Update 'subsystems'
subsystems = Collections.unmodifiableList(order);
}
/**
* Shuts the engine down.
*
* @param exitCode code to exit with, from 0-255
* @since v1-alpha0
*/
public synchronized void shutdown(@Range(from = 0, to = 255) int exitCode) {
if (state == EngineState.UNKNOWN || state == EngineState.SHUTDOWN)
return;
Logger.info("Shutting engine down");
if (state != EngineState.CRASHED)
state = EngineState.SHUTDOWN;
// Make engine single-threaded
Properties properties = new Properties();
properties.setProperty("sosengine.base.optimizeLogging", "false");
properties.setProperty("sosengine.base.optimizeEvents", "false");
EngineConfiguration.getInstance().loadConfiguration(properties);
// Flush log messages
LoggingQueue.flush();
// Disable safety shutdown hook
try {
Runtime.getRuntime().removeShutdownHook(safetyShutdownHook);
} catch (Exception ignored) {}
// Send events
Logger.verb("Notifying classes about shutdown");
new EngineShutdownEvent().callEvent();
Logger.verb("Notifying subsystems about shutdown");
new InternalEngineShutdownEvent().callEvent();
// Delete scheduled files
FileAccess.deleteScheduled();
// Invoke shutdown handler
Logger.verb("Invoking shutdown handler (code " + exitCode + ")");
shutdownHandler.shutdown((short) exitCode);
}
/**
* Shuts the engine down.
*
* @since v1-alpha0
*/
public void shutdown() {
if (instance != null)
instance.shutdown(0);
}
/** {@inheritDoc} */
@Override
public @NotNull String getName() {
return "base";
}
/**
* This method does nothing.
*
* @since v1-alpha1
*/
@Override
public void initializeSubsystem() {}
/** {@inheritDoc} */
@Override
public @NotNull DependencyVector getDependencyVector() {
return new DependencyVector.Builder()
.setIdentifier("engine")
.setVersioningSystem(StarOpenSourceVersioningSystem.class)
.setVersion(EngineInformation.getVersioningString())
.build();
}
/**
* Sets the engine state.
*
* @param state new state
* @throws IllegalAccessException if the caller class is unauthorized
* @since v1-alpha2
*/
public void setState(@NotNull EngineState state) throws IllegalAccessException {
if (!Thread.currentThread().getStackTrace()[2].getClassName().startsWith("de.staropensource.engine.base."))
throw new IllegalAccessException("Only classes inside the \"de.staropensource.engine.base\" package are allowed to call this method.");
this.state = state;
}
/**
* The default shutdown handler, which causes the JVM to exit.
*
* @see ShutdownHandler
* @see System#exit(int)
* @since v1-alpha2
*/
public static final class JvmShutdownHandler implements ShutdownHandler {
/**
* Constructs this class.
*
* @since v1-alpha2
*/
public JvmShutdownHandler() {}
/** {@inheritDoc} */
@Override
public void shutdown(short exitCode) {
// Check if already shutting down
try {
Thread thread = Thread.ofVirtual().unstarted(() -> {});
Runtime.getRuntime().addShutdownHook(thread);
Runtime.getRuntime().removeShutdownHook(thread);
} catch (IllegalStateException exception) {
Logger.warn("Terminating JVM: Already shutting down, skipping");
return;
}
Logger.warn("Terminating JVM");
Runtime.getRuntime().exit(exitCode);
}
}
}

View file

@ -0,0 +1,524 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base;
import de.staropensource.engine.base.annotation.EngineSubsystem;
import de.staropensource.engine.base.event.LogEvent;
import de.staropensource.engine.base.implementable.Configuration;
import de.staropensource.engine.base.implementable.ShortcodeParser;
import de.staropensource.engine.base.implementable.SubsystemClass;
import de.staropensource.engine.base.logging.Logger;
import de.staropensource.engine.base.logging.backend.async.LoggingThread;
import de.staropensource.engine.base.type.EngineState;
import de.staropensource.engine.base.type.logging.LogLevel;
import de.staropensource.engine.base.type.vector.Vec2f;
import de.staropensource.engine.base.type.vector.Vec2i;
import de.staropensource.engine.base.utility.PropertiesReader;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* Provides the base engine configuration.
* <p>
* This class does not only provide engine settings but is also
* responsible for loading them into memory from {@link Properties} objects.
* <p>
* Now you might ask why we didn't go with the string-based approach.
* The answer is simple: It's a maintenance burden.
* Having various settings strings scattered across many classes will cause
* trouble at some point, which will cause some strings to be undocumented
* or have an inconsistent naming scheme. Containing settings as variables in
* one centralized place mitigates this.
*
* @since v1-alpha0
*/
@Getter
@SuppressWarnings({ "JavadocDeclaration" })
public final class EngineConfiguration extends Configuration {
/**
* Contains the class instance.
*
* @since v1-alpha0
* -- GETTER --
* Returns the class instance.
*
* @return class instance unless {@link Engine} is uninitialized
* @since v1-alpha0
*/
@Getter
private static EngineConfiguration instance;
/**
* Contains the configuration prefix.
*
* @since v1-alpha0
* -- GETTER --
* Returns the configuration prefix.
*
* @return property group
* @since v1-alpha0
*/
private final @NotNull String group = "sosengine.base.";
/**
* Contains if debugging options should be allowed.
* All debugging options will be forcefully set to
* {@code false} if this option is set to {@code false}.
*
* @since v1-alpha0
* -- GETTER --
* Returns if debugging options should be allowed.
* All debugging options will be forcefully set to
* {@code false} if this option is set to {@code false}.
*
* @return debugging enabled?
* @since v1-alpha0
*/
private boolean debug;
/**
* Contains whether or not to log
* events being emitted.
* <p>
* This will cause all events to
* be logged, with the exception
* of the {@link LogEvent}.
*
* @since v1-alpha0
* -- GETTER --
* Returns whether or not to log
* events being emitted.
* <p>
* This will cause all events to
* be logged, with the exception
* of the {@link LogEvent}.
*
* @return detailed event logging enabled?
* @since v1-alpha0
*/
private boolean debugEvents;
/**
* Contains whether or not to automatically discover
* and initialize any class extending {@link SubsystemClass}
* whilst being annotated with {@link EngineSubsystem}.
* <p>
* This mechanism may fail in certain situations, where
* manual subsystem initialization may be desired. Make
* sure to disable this setting before engine startup
* and then initialize all subsystems manually.
*
* @see Engine
* @since v1-alpha5
* -- GETTER --
* Returns whether or not to automatically discover
* and initialize any class extending {@link SubsystemClass}
* whilst being annotated with {@link EngineSubsystem}.
* <p>
* This mechanism may fail in certain situations, where
* manual subsystem initialization may be desired. Make
* sure to disable this setting before engine startup
* and then initialize all subsystems manually.
*
* @return automatically discover and initialize subsystems?
* @since v1-alpha5
*/
private boolean initialPerformSubsystemInitialization;
/**
* Contains a set of class names to try to load
* and initialize as subsystems. Will only take effect
* if {@link #initialPerformSubsystemInitialization} is
* turned off.
*
* @since v1-alpha5
* -- GETTER --
* Returns a set of class names to try to load
* and initialize as subsystems. Will only take effect
* if {@link #getInitialIncludeSubsystemClasses()} is
* turned off.
*
* @return set of class names to try and initialize as subsystems
* @since v1-alpha5
*/
private Set<@NotNull String> initialIncludeSubsystemClasses;
/**
* Contains whether or not to complain about invalid
* shortcodes.
* <p>
* Requires the active log level to be set at least
* to {@link LogLevel#SILENT_WARNING} to have effect.
*
* @see #logLevel
* @since v1-alpha0
* -- GETTER --
* Returns whether or not to complain about invalid
* shortcodes.
* <p>
* Requires the active log level to be set at least
* to {@link LogLevel#SILENT_WARNING} to have effect.
*
* @return complain about invalid shortcodes?
* @see #getLogLevel()
* @since v1-alpha0
*/
private boolean errorShortcodeParser;
/**
* Contains if to log asynchronously.
* <p>
* If enabled, will cause a logging thread
* to spawn. All log messages will be queued
* and printed after a set delay
* ({@link #logPollingSpeed}).
* Highly recommended to keep enabled, or
* the performance of your application will
* very likely suffer.
*
* @see #logPollingSpeed
* @since v1-alpha0
* -- GETTER --
* Returns if to log asynchronously.
* <p>
* If enabled, will cause a logging thread
* to spawn. All log messages will be queued
* and printed after a set delay
* ({@link #getLogPollingSpeed()}).
* Highly recommended to keep enabled, or
* the performance of your application will
* very likely suffer.
*
* @return log asynchronously?
* @see #getLogPollingSpeed()
* @since v1-alpha0
*/
private boolean optimizeLogging;
/**
* Contains whether or not to emit events
* asynchronously.
* <p>
* This will cause a
* <a href="https://openjdk.org/jeps/444">VirtualThread</a>
* to spawn every time an event is emitted.
*
* @since v1-alpha0
* -- GETTER --
* Contains whether or not to emit events
* asynchronously.
* <p>
* This will cause a
* <a href="https://openjdk.org/jeps/444">VirtualThread</a>
* to spawn every time an event is emitted.
*
* @return emit events asynchronously?
* @since v1-alpha0
*/
private boolean optimizeEvents;
/**
* Contains the minimum allowed log level.
* <p>
* The priority list is as follows (from high to low priority):
* <ul>
* <li>{@link LogLevel#CRASH}</li>
* <li>{@link LogLevel#ERROR}</li>
* <li>{@link LogLevel#WARNING}</li>
* <li>{@link LogLevel#INFORMATIONAL}</li>
* <li>{@link LogLevel#SILENT_WARNING}</li>
* <li>{@link LogLevel#VERBOSE}</li>
* <li>{@link LogLevel#DIAGNOSTIC}</li>
* </ul>
*
* @since v1-alpha0
* -- GETTER --
* Returns the minimum allowed log level.
* <p>
* The priority list is as follows (from high to low priority):
* <ul>
* <li>{@link LogLevel#CRASH}</li>
* <li>{@link LogLevel#ERROR}</li>
* <li>{@link LogLevel#WARNING}</li>
* <li>{@link LogLevel#INFORMATIONAL}</li>
* <li>{@link LogLevel#SILENT_WARNING}</li>
* <li>{@link LogLevel#VERBOSE}</li>
* <li>{@link LogLevel#DIAGNOSTIC}</li>
* </ul>
*
* @return minimum allowed log level
* @since v1-alpha0
*/
private LogLevel logLevel;
/**
* Contains a comma-separated list of optional
* features to add to the final log output.
* <p>
* Available features (in order of appearance):
* <ul>
* <li><code>formatting</code></li>
* <li><code>runtime</code></li>
* <li><code>date</code></li>
* <li><code>time</code></li>
* <li><code>shortIssuerClass</code></li>
* <li><code>moduleName</code></li>
* <li><code>moduleVersion</code> (requires <code>moduleName</code>)</li>
* <li><code>methodName</code></li>
* <li><code>lineNumber</code></li>
* </ul>
*
* @since v1-alpha8
* -- GETTER --
* Returns a comma-separated list of optional
* features to add to the final log output.
* <p>
* Available features (in order of appearance):
* <ul>
* <li><code>formatting</code></li>
* <li><code>runtime</code></li>
* <li><code>date</code></li>
* <li><code>time</code></li>
* <li><code>shortIssuerClass</code></li>
* <li><code>moduleName</code></li>
* <li><code>moduleVersion</code> (requires <code>moduleName</code>)</li>
* <li><code>methodName</code></li>
* <li><code>lineNumber</code></li>
* </ul>
*
* @return optional features to enable
* @since v1-alpha8
*/
private Set<@NotNull String> logFeatures;
/**
* Contains how fast the logging thread will
* poll for queued messages in milliseconds.
* This also causes messages to be buffered.
* <p>
* Only applies if {@code optimizeLogging} is turned on.
* Values below {@code 1} will poll for queued messages
* as fast as it can. This however has pretty much no
* benefit. Leave it at {@code 5}, it works quite well.
*
* @see #optimizeLogging
* @since v1-alpha4
* -- GETTER --
* Contains how fast the logging thread will
* poll for queued messages, in milliseconds.
* This also causes messages to be buffered.
* <p>
* Only applies if {@code optimizeLogging} is turned on.
* Values below {@code 1} will poll for queued messages
* as fast as it can. This however has pretty much no
* benefit. Leave it at {@code 5}, it works quite well.
*
* @return logging thread polling speed in milliseconds
* @see #isOptimizeLogging()
* @since v1-alpha4
*/
private int logPollingSpeed;
/**
* Contains whether or not to forcefully write
* to the standard output instead of the
* standard error stream.
* <p>
* This only applies to the {@link LogLevel#ERROR} and
* {@link LogLevel#CRASH} log levels, as these use
* the standard error stream by default.
*
* @see <a href="https://man7.org/linux/man-pages/man3/stderr.3.html">man page about standard streams</a>
* @since v1-alpha0
* -- GETTER --
* Contains whether or not to forcefully write
* to the standard output instead of the
* standard error stream.
* <p>
* This only applies to the {@link LogLevel#ERROR} and
* {@link LogLevel#CRASH} log levels, as these use
* the standard error stream by default.
*
* @return force use stdout?
* @see <a href="https://man7.org/linux/man-pages/man3/stderr.3.html">man page about standard streams</a>
* @since v1-alpha0
*/
private boolean logForceStandardOutput;
/**
* Contains if to truncate the full path
* of a class when invoking using their
* {@link #toString()} method.
* <p>
* Here's an example: Lets say that you have a
* {@link Vec2f} instance and want to convert
* it to a String. You can do that by using
* {@link Vec2f}'s {@link Vec2f#toString()}
* method. With this flag disabled it will
* return
* {@code de.staropensource.engine.base.types.vectors.}{@link Vec2i}{@code (x=64 y=64)}.
* With this flag enabled however the method will return
* {@link Vec2i}{@code (x=64 y=64)},
* which is much smaller.
*
* @since v1-alpha2
* -- GETTER --
* Returns if to truncate the full path
* of a class when invoking using their
* {@link #toString()} method.
* <p>
* Here's an example: Lets say that you have a
* {@link Vec2f} instance and want to convert
* it to a String. You can do that by using
* {@link Vec2f}'s {@link Vec2f#toString()}
* method. With this flag disabled it will
* return
* {@code de.staropensource.engine.base.types.vectors.}{@link Vec2i}{@code (x=64 y=64)}.
* With this flag enabled however the method will return
* {@link Vec2i}{@code (x=64 y=64)},
* which is much smaller.
*
* @return truncate class paths?
* @since v1-alpha2
*/
private boolean hideFullTypePath;
/**
* Constructs this class.
*
* @see Engine
* @since v1-alpha6
*/
EngineConfiguration() {
super();
instance = this;
// Load default configuration
loadDefaultConfiguration();
}
/** {@inheritDoc} */
@Override
protected void matchProperty(@NotNull PropertiesReader parser, @NotNull String property) {
try {
switch (property) {
case "debug" -> debug = parser.getBoolean(group + property);
case "debugEvents" -> debugEvents = parser.getBoolean(group + property);
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property);
case "initialIncludeSubsystemClasses" -> {
initialIncludeSubsystemClasses = new HashSet<>();
initialIncludeSubsystemClasses.addAll(Arrays.stream(parser.getString(group + property).split(",")).toList());
}
case "errorShortcodeParser" -> errorShortcodeParser = parser.getBoolean(group + property);
case "optimizeLogging" -> {
optimizeLogging = parser.getBoolean(group + property);
// Start logging thread automatically
if (optimizeLogging && Engine.getInstance().getState() == EngineState.RUNNING) {
LoggingThread.startThread(false);
}
}
case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property);
case "logLevel" -> {
try {
logLevel = LogLevel.valueOf(parser.getString(group + property).toUpperCase());
} catch (IllegalArgumentException ignored) {
Logger.error("The log level '" + parser.getString(group + property) + "' is not valid");
}
}
case "logFeatures" -> logFeatures = Set.copyOf(Arrays.stream(parser.getString(group + property).split(",")).toList());
case "logPollingSpeed" -> logPollingSpeed = parser.getInteger(group + property, true);
case "logForceStandardOutput" -> logForceStandardOutput = parser.getBoolean(group + property);
case "hideFullTypePath" -> hideFullTypePath = parser.getBoolean(group + property);
}
} catch (NullPointerException ignored) {}
}
/** {@inheritDoc} */
@Override
protected void processSettings(@NotNull PropertiesReader parser) {
// Disable all debugging switches if 'debug' is disabled
if (!debug) {
debugEvents = false;
}
}
/** {@inheritDoc} */
@Override
public void loadDefaultConfiguration() {
debug = false;
debugEvents = false;
initialPerformSubsystemInitialization = true;
initialIncludeSubsystemClasses = new HashSet<>();
errorShortcodeParser = true;
optimizeLogging = true;
optimizeEvents = true;
logLevel = LogLevel.INFORMATIONAL;
logFeatures = Set.of("formatting", "time", "methodName", "lineNumber");
logPollingSpeed = 5;
logForceStandardOutput = false;
hideFullTypePath = false;
}
/** {@inheritDoc} */
@Override
public @Nullable Object getSetting(@NotNull String setting) {
return switch (setting) {
case "debug" -> debug;
case "debugEvents" -> debugEvents;
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
case "errorShortcodeParser" -> errorShortcodeParser;
case "optimizeLogging" -> optimizeLogging;
case "optimizeEvents" -> optimizeEvents;
case "logLevel" -> logLevel;
case "logFeatures" -> logFeatures;
case "logPollingSpeed" -> logPollingSpeed;
case "logForceStandardOutput" -> logForceStandardOutput;
case "hideFullTypePath" -> hideFullTypePath;
default -> null;
};
}
}

View file

@ -17,12 +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; package de.staropensource.engine.base;
import de.staropensource.sosengine.base.implementable.ShutdownHandler; import de.staropensource.engine.base.exception.IllegalAccessException;
import de.staropensource.sosengine.base.exception.IllegalAccessException; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.implementable.EventListenerCode;
import de.staropensource.sosengine.base.type.InternalAccessArea; import de.staropensource.engine.base.implementable.ShutdownHandler;
import de.staropensource.engine.base.implementable.helper.EventHelper;
import de.staropensource.engine.base.logging.Logger;
import de.staropensource.engine.base.type.InternalAccessArea;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -51,14 +54,6 @@ public final class EngineInternals {
@Getter @Getter
private static EngineInternals instance; private static EngineInternals instance;
/**
* Contains the {@link LoggerInstance} for this instance.
*
* @see LoggerInstance
* @since v1-alpha4
*/
private static final LoggerInstance logger = new LoggerInstance.Builder().setClazz(EngineInternals.class).setOrigin("ENGINE").build();
/** /**
* Contains all disabled internal access areas. * Contains all disabled internal access areas.
* *
@ -73,16 +68,31 @@ public final class EngineInternals {
private final @NotNull List<@NotNull InternalAccessArea> restrictedAreas = new ArrayList<>(); private final @NotNull List<@NotNull InternalAccessArea> restrictedAreas = new ArrayList<>();
/** /**
* Constructs this class. * Contains whether the engine should reflectively
* search the classpath for events or other annotations.
* <p>
* If disabled, code will either have to manually call
* registration methods or certain classes have to
* be created in a certain package, depending on the
* use case and application.
* *
* @since v1-alpha4 * @see EventHelper#registerEvent(Class, EventListenerCode)
* @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
* @since v1-alpha5
*/ */
public EngineInternals() { private boolean reflectiveClasspathScanning = true;
/**
* Creates and initializes an instance of this class.
*
* @since v1-alpha6
*/
EngineInternals() {
// Only allow one instance // Only allow one instance
if (instance == null && Engine.getInstance() != null) if (instance == null && Engine.getInstance() != null)
instance = this; instance = this;
else else
logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance"); Logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
} }
/** /**
@ -110,10 +120,12 @@ public final class EngineInternals {
areas.remove(InternalAccessArea.ALL); areas.remove(InternalAccessArea.ALL);
areas.remove(InternalAccessArea.ALL_READ); areas.remove(InternalAccessArea.ALL_READ);
areas.remove(InternalAccessArea.ALL_WRITE); areas.remove(InternalAccessArea.ALL_WRITE);
areas.remove(InternalAccessArea.ALL_READ_ESSENTIAL);
restrictedAreas.addAll(areas); restrictedAreas.addAll(areas);
} }
case ALL_READ -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesReadOnly()).toList());
case ALL_WRITE -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesWriteOnly()).toList()); case ALL_WRITE -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesWriteOnly()).toList());
case ALL_READ -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesReadOnly()).toList());
case ALL_READ_ESSENTIAL -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesEssentialReadOnly()).toList());
default -> restrictedAreas.add(area); default -> restrictedAreas.add(area);
} }
} }
@ -125,11 +137,11 @@ public final class EngineInternals {
* Highly recommended to keep enabled. * Highly recommended to keep enabled.
* *
* @param status {@code true} to install, {@code false} otherwise * @param status {@code true} to install, {@code false} otherwise
* @throws IllegalAccessException when restricted * @throws IllegalAccessException when restricted ({@link InternalAccessArea#SAFETY_SHUTDOWN_HOOK_UPDATE})
* @since v1-alpha4 * @since v1-alpha4
*/ */
public void installSafetyShutdownHook(boolean status) throws IllegalAccessException { public void installSafetyShutdownHook(boolean status) throws IllegalAccessException {
isRestricted(InternalAccessArea.SAFETY_SHUTDOWN_HOOK); isRestricted(InternalAccessArea.SAFETY_SHUTDOWN_HOOK_UPDATE);
try { try {
if (status) if (status)
@ -139,13 +151,27 @@ public final class EngineInternals {
} catch (IllegalArgumentException | IllegalStateException ignored) {} } catch (IllegalArgumentException | IllegalStateException ignored) {}
} }
/**
* Gets the engine's shutdown handler.
* The shutdown handler is responsible for
* shutting down the JVM safely.
*
* @return shutdown handler
* @throws IllegalAccessException when restricted ({@link InternalAccessArea#SHUTDOWN_HANDLER_GET})
* @since v1-alpha4
*/
public @NotNull ShutdownHandler getShutdownHandler() throws IllegalAccessException {
isRestricted(InternalAccessArea.SHUTDOWN_HANDLER_GET);
return Engine.getInstance().getShutdownHandler();
}
/** /**
* Sets the engine's shutdown handler. * Sets the engine's shutdown handler.
* The shutdown handler is responsible for * The shutdown handler is responsible for
* shutting down the JVM safely. * shutting down the JVM safely.
* *
* @param shutdownHandler new shutdown handler * @param shutdownHandler new shutdown handler
* @throws IllegalAccessException when restricted * @throws IllegalAccessException when restricted ({@link InternalAccessArea#SHUTDOWN_HANDLER_UPDATE})
* @since v1-alpha4 * @since v1-alpha4
*/ */
public void setShutdownHandler(@NotNull ShutdownHandler shutdownHandler) throws IllegalAccessException { public void setShutdownHandler(@NotNull ShutdownHandler shutdownHandler) throws IllegalAccessException {
@ -154,16 +180,47 @@ public final class EngineInternals {
} }
/** /**
* Gets the engine's shutdown handler. * Returns whether the engine should reflectively
* The shutdown handler is responsible for * search the classpath for events or other annotations.
* shutting down the JVM safely. * <p>
* If disabled, code will either have to manually call
* registration methods or certain classes have to
* be created in a certain package, depending on the
* use case and application.
* *
* @return shutdown handler * @return reflective classpath scanning flag state
* @throws IllegalAccessException when restricted * @throws IllegalAccessException when restricted ({@link InternalAccessArea#REFLECTIVE_CLASSPATH_SCANNING_GET})
* @since v1-alpha4 * @see EventHelper#registerEvent(Class, EventListenerCode)
* @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
* @since v1-alpha5
*/ */
public @NotNull ShutdownHandler getShutdownHandler() throws IllegalAccessException { public boolean getReflectiveClasspathScanning() throws IllegalAccessException {
isRestricted(InternalAccessArea.SHUTDOWN_HANDLER_GET); isRestricted(InternalAccessArea.REFLECTIVE_CLASSPATH_SCANNING_GET);
return Engine.getInstance().getShutdownHandler(); return reflectiveClasspathScanning;
}
/**
* Overrides whether the engine should reflectively
* search the classpath for events or other annotations.
* <p>
* If disabled, code will either have to manually call
* registration methods or certain classes have to
* be created in a certain package, depending on the
* use case and application.
* <p>
* Enabling reflective classpath scanning in an unsupported
* environment may cause minor to extreme side effects,
* including but not limited to <b>bugs, exceptions, engine
* or even whole JVM crashes</b>. <i>You have been warned!</i>
*
* @param reflectiveClasspathScanning new reflective classpath scanning
* @throws IllegalAccessException when restricted ({@link InternalAccessArea#REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE})
* @see EventHelper#registerEvent(Class, EventListenerCode)
* @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
* @since v1-alpha5
*/
public void overrideReflectiveClasspathScanning(boolean reflectiveClasspathScanning) throws IllegalAccessException {
isRestricted(InternalAccessArea.REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE);
this.reflectiveClasspathScanning = reflectiveClasspathScanning;
} }
} }

View file

@ -17,9 +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.annotation; package de.staropensource.engine.base.annotation;
import de.staropensource.sosengine.base.implementable.SubsystemClass; import de.staropensource.engine.base.implementable.SubsystemClass;
import java.lang.annotation.*; import java.lang.annotation.*;

View file

@ -17,10 +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.annotation; package de.staropensource.engine.base.annotation;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.type.EventPriority;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.lang.annotation.*; import java.lang.annotation.*;
@ -48,8 +47,8 @@ public @interface EventListener {
* Specifies the priority of the event. * Specifies the priority of the event.
* *
* @return event priority * @return event priority
* @see EventPriority * @see Event.Priority
* @since v1-alpha0 * @since v1-alpha0
*/ */
@NotNull EventPriority priority() default EventPriority.DEFAULT; @NotNull Event.Priority priority() default Event.Priority.DEFAULT;
} }

View file

@ -23,4 +23,4 @@
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
package de.staropensource.sosengine.base.annotation; package de.staropensource.engine.base.annotation;

View file

@ -17,10 +17,10 @@
* 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.event; package de.staropensource.engine.base.event;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.implementable.helper.EventHelper;
/** /**
* Called in the event of an engine crash. * Called in the event of an engine crash.
@ -29,7 +29,7 @@ import de.staropensource.sosengine.base.implementable.helper.EventHelper;
*/ */
public final class EngineCrashEvent implements Event { public final class EngineCrashEvent implements Event {
/** /**
* Constructs this event. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.event; package de.staropensource.engine.base.event;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.implementable.helper.EventHelper;
/** /**
* Called when the engine is about to shutdown. * Called when the engine is about to shutdown.
@ -29,7 +29,7 @@ import de.staropensource.sosengine.base.implementable.helper.EventHelper;
*/ */
public final class EngineShutdownEvent implements Event { public final class EngineShutdownEvent implements Event {
/** /**
* Constructs this event. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,11 +17,11 @@
* 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.event; package de.staropensource.engine.base.event;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.implementable.helper.EventHelper;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
/** /**
* Called in the event of a soft engine crash * Called in the event of a soft engine crash
@ -33,7 +33,7 @@ import de.staropensource.sosengine.base.logging.Logger;
*/ */
public final class EngineSoftCrashEvent implements Event { public final class EngineSoftCrashEvent implements Event {
/** /**
* Constructs this event. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,13 +17,13 @@
* 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.internal.event; package de.staropensource.engine.base.event;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.implementable.helper.EventHelper;
/** /**
* Called when the engine is about to shutdown, after {@link de.staropensource.sosengine.base.event.EngineShutdownEvent}. * Called when the engine is about to shutdown, after {@link de.staropensource.engine.base.event.EngineShutdownEvent}.
* <p> * <p>
* Meant for subsystems to perform cleanup and shutdown routines, not for applications. * Meant for subsystems to perform cleanup and shutdown routines, not for applications.
* *
@ -31,7 +31,7 @@ import de.staropensource.sosengine.base.implementable.helper.EventHelper;
*/ */
public final class InternalEngineShutdownEvent implements Event { public final class InternalEngineShutdownEvent implements Event {
/** /**
* Constructs this event. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,11 +17,11 @@
* 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.event; package de.staropensource.engine.base.event;
import de.staropensource.sosengine.base.implementable.Event; import de.staropensource.engine.base.implementable.Event;
import de.staropensource.sosengine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.implementable.helper.EventHelper;
import de.staropensource.sosengine.base.type.logging.LogLevel; import de.staropensource.engine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
*/ */
public final class LogEvent implements Event { public final class LogEvent implements Event {
/** /**
* Constructs this event. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -22,4 +22,4 @@
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.event; package de.staropensource.engine.base.event;

View file

@ -17,7 +17,7 @@
* 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.exception; package de.staropensource.engine.base.exception;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,14 +28,14 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class IllegalAccessException extends RuntimeException { public class IllegalAccessException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
public IllegalAccessException() {} public IllegalAccessException() {}
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param message message * @param message message
* @since v1-alpha2 * @since v1-alpha2

View file

@ -17,7 +17,7 @@
* 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.exception; package de.staropensource.engine.base.exception;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class ParserException extends RuntimeException { public class ParserException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param message parsing error * @param message parsing error
* @since v1-alpha2 * @since v1-alpha2

View file

@ -17,9 +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.exception; package de.staropensource.engine.base.exception;
import de.staropensource.sosengine.base.type.Tristate; import de.staropensource.engine.base.type.Tristate;
/** /**
* Thrown when converting a {@link Tristate} into a {@link Boolean} fails. * Thrown when converting a {@link Tristate} into a {@link Boolean} fails.
@ -32,7 +32,7 @@ import de.staropensource.sosengine.base.type.Tristate;
*/ */
public class TristateConversionException extends RuntimeException { public class TristateConversionException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */

View file

@ -17,7 +17,7 @@
* 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.exception; package de.staropensource.engine.base.exception;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class UnexpectedCheckEndException extends RuntimeException { public class UnexpectedCheckEndException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param checkOccurrence the sequence of checks that failed * @param checkOccurrence the sequence of checks that failed
* @since v1-alpha2 * @since v1-alpha2
@ -38,7 +38,7 @@ public class UnexpectedCheckEndException extends RuntimeException {
} }
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */

View file

@ -17,9 +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.exception.dependency; package de.staropensource.engine.base.exception.dependency;
import de.staropensource.sosengine.base.utility.DependencyResolver; import de.staropensource.engine.base.utility.DependencyResolver;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class DependencyCycleException extends RuntimeException { public class DependencyCycleException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param path cycle path * @param path cycle path
* @since v1-alpha1 * @since v1-alpha1

View file

@ -17,10 +17,10 @@
* 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.exception.dependency; package de.staropensource.engine.base.exception.dependency;
import de.staropensource.sosengine.base.type.DependencyVector; import de.staropensource.engine.base.type.DependencyVector;
import de.staropensource.sosengine.base.utility.DependencyResolver; import de.staropensource.engine.base.utility.DependencyResolver;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -48,7 +48,7 @@ public class UnmetDependenciesException extends Exception {
private final @NotNull List<@NotNull String> unmetDependencies; private final @NotNull List<@NotNull String> unmetDependencies;
/** /**
* Constructs this exception. * Creates and initializes an instance of this event.
* *
* @param unmetDependencies map of all unmet dependencies * @param unmetDependencies map of all unmet dependencies
* @see #unmetDependencies * @see #unmetDependencies

View file

@ -20,7 +20,7 @@
/** /**
* Exceptions related to dependency resolving. * Exceptions related to dependency resolving.
* *
* @see de.staropensource.sosengine.base.utility.DependencyResolver * @see de.staropensource.engine.base.utility.DependencyResolver
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.exception.dependency; package de.staropensource.engine.base.exception.dependency;

View file

@ -22,4 +22,4 @@
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.exception; package de.staropensource.engine.base.exception;

View file

@ -17,10 +17,10 @@
* 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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import de.staropensource.sosengine.base.type.reflection.ClassType; import de.staropensource.engine.base.type.reflection.ClassType;
import de.staropensource.sosengine.base.utility.ListFormatter; import de.staropensource.engine.base.utility.misc.ListFormatter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -30,18 +30,18 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class IncompatibleTypeException extends RuntimeException { public class IncompatibleTypeException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param methodName name of the method that failed * @param methodName name of the method that failed
* @param requiredClassType class type received by the method * @param requiredClassType class type received by the method
* @param compatibleTypes class types the method is compatible with * @param compatibleTypes class types the method is compatible with
*/ */
public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType[] compatibleTypes) { public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType @NotNull [] 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. * Creates and initializes an instance of this exception.
* *
* @param methodName name of the method that failed * @param methodName name of the method that failed
* @param requiredClassType class type received by the method * @param requiredClassType class type received by the method

View file

@ -17,7 +17,7 @@
* 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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class InstanceMethodFromStaticContextException extends Exception { public class InstanceMethodFromStaticContextException extends Exception {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param methodName name of the method * @param methodName name of the method
* @since v1-alpha2 * @since v1-alpha2

View file

@ -17,9 +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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import de.staropensource.sosengine.base.reflection.ReflectionClass; import de.staropensource.engine.base.reflection.ReflectionClass;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class InvalidFieldException extends Exception { public class InvalidFieldException extends Exception {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param clazz caller {@link ReflectionClass} * @param clazz caller {@link ReflectionClass}
* @param fieldName name of the invalid field * @param fieldName name of the invalid field

View file

@ -17,9 +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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import de.staropensource.sosengine.base.reflection.ReflectionClass; import de.staropensource.engine.base.reflection.ReflectionClass;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class InvalidMethodException extends Exception { public class InvalidMethodException extends Exception {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param clazz caller {@link ReflectionClass} * @param clazz caller {@link ReflectionClass}
* @param fieldName name of the invalid method * @param fieldName name of the invalid method

View file

@ -17,22 +17,23 @@
* 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.exception.reflection; package de.staropensource.engine.base.exception.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. * Thrown when a method could not be found due to an invalid method signature.
* *
* @since v1-alpha2 * @since v1-alpha5
*/ */
public class InvalidMethodSignature extends Exception { public class InvalidMethodSignatureException extends Exception {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param methodName method name * @param methodName method name
* @since v1-alpha5
*/ */
public InvalidMethodSignature(@NotNull String methodName) { public InvalidMethodSignatureException(@NotNull String methodName) {
super("Method " + methodName + " has a different method signature"); super("Method " + methodName + " has a different method signature");
} }
} }

View file

@ -17,7 +17,7 @@
* 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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
public class NoAccessException extends Exception { public class NoAccessException extends Exception {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param type {@code class}, {@code method} or {@code field} * @param type {@code class}, {@code method} or {@code field}
* @param name class, method or field name * @param name class, method or field name

View file

@ -17,7 +17,7 @@
* 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.exception.reflection; package de.staropensource.engine.base.exception.reflection;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -43,7 +43,7 @@ public class StaticInitializerException extends Exception {
private final @NotNull Throwable throwable; private final @NotNull Throwable throwable;
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param throwable throwable thrown by the static initializer * @param throwable throwable thrown by the static initializer
* @since v1-alpha2 * @since v1-alpha2

View file

@ -20,7 +20,7 @@
/** /**
* Exceptions related to reflection. * Exceptions related to reflection.
* *
* @see de.staropensource.sosengine.base.reflection * @see de.staropensource.engine.base.reflection
* @since v1-alpha2 * @since v1-alpha2
*/ */
package de.staropensource.sosengine.base.exception.reflection; package de.staropensource.engine.base.exception.reflection;

View file

@ -17,9 +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.exception.versioning; package de.staropensource.engine.base.exception.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
/** /**
* Thrown when trying to compare a {@link VersioningSystem} against another * Thrown when trying to compare a {@link VersioningSystem} against another
@ -29,7 +29,7 @@ import de.staropensource.sosengine.base.implementable.VersioningSystem;
*/ */
public class IncompatibleVersioningSystemException extends RuntimeException { public class IncompatibleVersioningSystemException extends RuntimeException {
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param required required versioning system ie. the versioning system throwing this error * @param required required versioning system ie. the versioning system throwing this error
* @param found found versioning system ie. the incompatible one * @param found found versioning system ie. the incompatible one

View file

@ -17,9 +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.exception.versioning; package de.staropensource.engine.base.exception.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -51,7 +51,7 @@ public class InvalidVersionStringException extends Exception {
private final @Nullable Throwable throwable; private final @Nullable Throwable throwable;
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param versioningSystem versioning system that is unable to parse version strings * @param versioningSystem versioning system that is unable to parse version strings
* @param versionString version string {@code a} * @param versionString version string {@code a}
@ -65,7 +65,7 @@ public class InvalidVersionStringException extends Exception {
} }
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param versioningSystem versioning system that is unable to parse version strings * @param versioningSystem versioning system that is unable to parse version strings
* @param versionString version string {@code a} * @param versionString version string {@code a}
@ -78,7 +78,7 @@ public class InvalidVersionStringException extends Exception {
} }
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param versioningSystem versioning system that is unable to parse version strings * @param versioningSystem versioning system that is unable to parse version strings
* @param versionString version string {@code a} * @param versionString version string {@code a}
@ -91,7 +91,7 @@ public class InvalidVersionStringException extends Exception {
} }
/** /**
* Constructs this exception. * Creates and initializes an instance of this exception.
* *
* @param versioningSystem versioning system that is unable to parse version strings * @param versioningSystem versioning system that is unable to parse version strings
* @param versionString version string {@code a} * @param versionString version string {@code a}

View file

@ -18,9 +18,9 @@
*/ */
/** /**
* Exceptions thrown by implementations of {@link de.staropensource.sosengine.base.implementable.VersioningSystem}s. * Exceptions thrown by implementations of {@link de.staropensource.engine.base.implementable.VersioningSystem}s.
* *
* @see de.staropensource.sosengine.base.implementable.VersioningSystem * @see de.staropensource.engine.base.implementable.VersioningSystem
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.exception.versioning; package de.staropensource.engine.base.exception.versioning;

View file

@ -17,10 +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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.utility.PropertiesReader;
import de.staropensource.sosengine.base.utility.PropertiesReader;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -37,23 +36,11 @@ import java.util.Properties;
*/ */
public abstract class Configuration { public abstract class Configuration {
/** /**
* Contains the {@link LoggerInstance} for this instance. * Creates and initializes an instance of this abstract class.
* *
* @see LoggerInstance
* @since v1-alpha1
*/
protected final @NotNull LoggerInstance logger;
/**
* Constructs this class.
*
* @param origin see {@link LoggerInstance.Builder#setOrigin(String)}
* @since v1-alpha2 * @since v1-alpha2
*/ */
public Configuration(@NotNull String origin) { protected Configuration() {
// Set logger instance
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin(origin).build();
// Load default configuration // Load default configuration
loadDefaultConfiguration(); loadDefaultConfiguration();
} }
@ -100,7 +87,7 @@ public abstract class Configuration {
} }
/** /**
* Returns the group in which setting overrides must begin with. * Returns prefix properties must begin with.
* *
* @return property group * @return property group
* @since v1-alpha2 * @since v1-alpha2

View file

@ -0,0 +1,110 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base.implementable;
import de.staropensource.engine.base.annotation.EventListener;
import de.staropensource.engine.base.implementable.helper.EventHelper;
/**
* Represents an event.
*
* @see EventHelper
* @since v1-alpha0
*/
public interface Event {
/**
* Emits the event and calls all event listeners.
*
* @since v1-alpha0
*/
void callEvent();
/**
* Specifies in which order {@link EventListener}s shall be called.
*
* @since v1-alpha9
*/
@SuppressWarnings({ "unused" })
enum Priority {
/**
* {@link EventListener}s with this
* priority are called before all others.
* <p>
* This priority is exclusive to the
* engine and subsystems and should
* not be used by applications.
*
* @since v1-alpha9
*/
EXCLUSIVELY_IMPORTANT,
/**
* {@link EventListener}s with
* this priority are called 2nd.
*
* @since v1-alpha9
*/
VERY_IMPORTANT,
/**
* {@link EventListener}s with
* this priority are called 3rd.
*
* @since v1-alpha9
*/
IMPORTANT,
/**
* {@link EventListener}s with
* this priority are called 4th.
*
* @since v1-alpha9
*/
DEFAULT,
/**
* {@link EventListener}s with
* this priority are called 5th.
*
* @since v1-alpha9
*/
UNIMPORTANT,
/**
* {@link EventListener}s with
* this priority are called 6th.
*
* @since v1-alpha9
*/
VERY_UNIMPORTANT,
/**
* {@link EventListener}s with this
* priority are called after all others.
* <p>
* This priority is exclusive to the
* engine and subsystems and should
* not be used by applications.
*
* @since v1-alpha9
*/
EXCLUSIVELY_UNIMPORTANT
}
}

View file

@ -17,41 +17,42 @@
* 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.internal.implementation.placeholder.crashhandler; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.helper.EventHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Locale;
/** /**
* Implements the {@code issuer_origin} placeholder. * Used by {@link EventHelper} to execute event listeners.
* *
* @see Placeholder * @see Runnable
* @since v1-alpha0 * @since v1-alpha5
*/ */
@SuppressWarnings({ "unused" }) public abstract class EventListenerCode {
public final class IssuerOrigin implements Placeholder {
/** /**
* Issuer origin to use. * Contains the priority of this
* event listener.
* <p>
* Set automatically by {@link EventHelper},
* do not change this manually.
* *
* @since v1-alpha2 * @since v1-alpha5
*/ */
private final @NotNull String issuerOrigin; public @NotNull Event.Priority priority = Event.Priority.DEFAULT;
/** /**
* Constructs this class. * Creates and initializes an instance of this abstract class.
* *
* @param issuerOrigin issuer origin to use * @since v1-alpha5
* @since v1-alpha0
*/ */
public IssuerOrigin(@NotNull String issuerOrigin) { protected EventListenerCode() {}
this.issuerOrigin = issuerOrigin;
}
/** {@inheritDoc} */ /**
@Override * Invokes the event listener.
public @NotNull String replace(@NotNull String text) { *
return text.replace("%issuer_origin%", issuerOrigin.toUpperCase(Locale.ROOT)); * @param arguments arguments passed along by the event
} * @throws Exception exceptions thrown
* @since v1-alpha5
*/
public abstract void run(Object... arguments) throws Exception;
} }

View file

@ -17,39 +17,27 @@
* 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.internal.implementation.placeholder.crashhandler; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.engine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Implements the {@code issuer_path} placeholder. * Interface for implementing custom logger implementations.
* *
* @see Placeholder * @see Logger#setLoggingAdapter(LoggingAdapter)
* @since v1-alpha0 * @since v1-alpha0
*/ */
@SuppressWarnings({ "unused" }) public interface LoggingAdapter {
public final class IssuerPath implements Placeholder {
/** /**
* Issuer class to use. * Prints a log message.
* *
* @param level level of the log call
* @param issuer {@link StackTraceElement} of the issuer
* @param message raw message
* @param format processed log call output (print this!)
* @since v1-alpha2 * @since v1-alpha2
*/ */
private final @NotNull Class<?> issuerClass; void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format);
/**
* Constructs this class.
*
* @param issuerClass issuer class to use
* @since v1-alpha0
*/
public IssuerPath(@NotNull Class<?> issuerClass) {
this.issuerClass = issuerClass;
}
/** {@inheritDoc} */
@Override
public @NotNull String replace(@NotNull String text) {
return text.replace("%issuer_path%", issuerClass.getName());
}
} }

View file

@ -17,9 +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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.utility.PlaceholderEngine; import de.staropensource.engine.base.utility.PlaceholderEngine;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**

View file

@ -17,11 +17,11 @@
* 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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.sosengine.base.exception.ParserException; import de.staropensource.engine.base.exception.ParserException;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.logging.Logger;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -29,7 +29,7 @@ import java.util.LinkedList;
import java.util.Locale; import java.util.Locale;
/** /**
* Base class for implementing a shortcode converter. * Base class for implementing a shortcode parser.
* <p> * <p>
* This class parses a string and converts it into a list of * This class parses a string and converts it into a list of
* components, which can then be in turn be converted to something * components, which can then be in turn be converted to something
@ -48,16 +48,9 @@ import java.util.Locale;
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
@Getter
@SuppressWarnings({ "JavadocDeclaration" }) @SuppressWarnings({ "JavadocDeclaration" })
public abstract class ShortcodeParser { public abstract class ShortcodeParser {
/**
* Contains the {@link LoggerInstance} for this instance.
*
* @see LoggerInstance
* @since v1-alpha1
*/
protected final @NotNull LoggerInstance logger;
/** /**
* Contains a list of components the parsed text is made out of. * Contains a list of components the parsed text is made out of.
* *
@ -68,19 +61,17 @@ public abstract class ShortcodeParser {
* @return component list * @return component list
* @since v1-alpha1 * @since v1-alpha1
*/ */
@Getter
protected final @NotNull LinkedList<String> components; protected final @NotNull LinkedList<String> components;
/** /**
* Constructs this class. * Creates and initializes an instance of this abstract class.
* *
* @param string string to parse * @param string string to parse
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
* @throws ParserException on error * @throws ParserException on error
* @since v1-alpha2 * @since v1-alpha2
*/ */
public ShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException { protected ShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
components = parse(string, ignoreInvalidEscapes); components = parse(string, ignoreInvalidEscapes);
} }
@ -92,7 +83,7 @@ public abstract class ShortcodeParser {
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
* @return list of components * @return list of components
* @throws ParserException on error * @throws ParserException on error
* @see EngineConfiguration#errorShortcodeConverter * @see EngineConfiguration#errorShortcodeParser
* @since v1-alpha2 * @since v1-alpha2
*/ */
protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException { protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
@ -128,110 +119,53 @@ public abstract class ShortcodeParser {
tagActive = false; tagActive = false;
// fg:* // fg:*
if (part.toString().startsWith("fg:")) { if (part.toString().startsWith("fg:"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=fg data=" + part.substring(3).toUpperCase());
if (isValidColor(part.substring(3).toUpperCase())) if (isValidColor(part.substring(3).toUpperCase()))
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase()); components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
else { else {
// Complain about invalid shortcode // Complain about invalid shortcode
if (EngineConfiguration.getInstance().isErrorShortcodeConverter()) if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part); Logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text // Convert tag regular text
components.add("TEXT:" + "<" + part + ">"); components.add("TEXT:" + "<" + part + ">");
} }
}
// bg:* // bg:*
else if (part.toString().startsWith("bg:")) { else if (part.toString().startsWith("bg:"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=bg data=" + part.substring(3).toUpperCase());
if (isValidColor(part.substring(3).toUpperCase())) if (isValidColor(part.substring(3).toUpperCase()))
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase()); components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
else { else {
// Complain about invalid shortcode // Complain about invalid shortcode
if (EngineConfiguration.getInstance().isErrorShortcodeConverter()) if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part); Logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text // Convert tag regular text
components.add("TEXT:" + "<" + part + ">"); components.add("TEXT:" + "<" + part + ">");
} }
}
// bold // bold
else if (part.toString().equals("bold")) { else if (part.toString().equals("bold"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=bold");
// Insert attribute
components.add("ATTRIBUTE:BOLD"); components.add("ATTRIBUTE:BOLD");
}
// italic // italic
else if (part.toString().equals("italic")) { else if (part.toString().equals("italic"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=italic");
// Insert attribute
components.add("ATTRIBUTE:ITALIC"); components.add("ATTRIBUTE:ITALIC");
}
// strikethrough // strikethrough
else if (part.toString().equals("strikethrough")) { else if (part.toString().equals("strikethrough"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=strikethrough");
// Insert attribute
components.add("ATTRIBUTE:STRIKETHROUGH"); components.add("ATTRIBUTE:STRIKETHROUGH");
}
// underline // underline
else if (part.toString().equals("underline")) { else if (part.toString().equals("underline"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=underline");
// Insert attribute
components.add("ATTRIBUTE:UNDERLINE"); components.add("ATTRIBUTE:UNDERLINE");
} // blink
else if (part.toString().equals("blink"))
// underline
else if (part.toString().equals("blink")) {
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=blink");
// Insert attribute
components.add("ATTRIBUTE:BLINK"); components.add("ATTRIBUTE:BLINK");
}
// reset // reset
else if (part.toString().equals("reset")) { else if (part.toString().equals("reset"))
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=reset");
// Insert reset
components.add("RESET"); components.add("RESET");
}
// error case // error case
else { else {
// Print debug message
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " invalidtag=" + part);
// Complain about invalid shortcode // Complain about invalid shortcode
if (EngineConfiguration.getInstance().isErrorShortcodeConverter()) if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
logger.sarn("Invalid shortcode: " + part); Logger.sarn("Invalid shortcode: " + part);
// Convert tag regular text // Convert tag regular text
components.add("TEXT:" + "<" + part + ">"); components.add("TEXT:" + "<" + part + ">");
@ -248,9 +182,6 @@ public abstract class ShortcodeParser {
if (character == '<') { if (character == '<') {
if (!part.isEmpty()) { if (!part.isEmpty()) {
// Tag is starting, insert previous text // Tag is starting, insert previous text
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " text=" + part);
components.add("TEXT:" + part); components.add("TEXT:" + part);
part = new StringBuilder(); part = new StringBuilder();
} }
@ -264,12 +195,8 @@ public abstract class ShortcodeParser {
} }
// Processing ended, insert leftover text // Processing ended, insert leftover text
if (!part.isEmpty()) { if (!part.isEmpty())
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
System.out.println(getClass().getName() + "#" + string.hashCode() + " endtext=" + part);
components.add("TEXT:" + part); components.add("TEXT:" + part);
}
return components; return components;
} }

View file

@ -17,9 +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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.Engine; import de.staropensource.engine.base.Engine;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
/** /**

View file

@ -17,37 +17,28 @@
* 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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.Engine; import de.staropensource.engine.base.Engine;
import de.staropensource.sosengine.base.annotation.EngineSubsystem; import de.staropensource.engine.base.annotation.EngineSubsystem;
import de.staropensource.sosengine.base.annotation.EventListener; import de.staropensource.engine.base.annotation.EventListener;
import de.staropensource.sosengine.base.internal.event.InternalEngineShutdownEvent; import de.staropensource.engine.base.event.InternalEngineShutdownEvent;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.type.DependencyVector;
import de.staropensource.sosengine.base.type.DependencyVector;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Interface for building subsystem main classes. * Abstract class for building subsystem main classes.
* *
* @see EngineSubsystem * @see EngineSubsystem
* @since v1-alpha0 * @since v1-alpha0
*/ */
public abstract class SubsystemClass { public abstract class SubsystemClass {
/** /**
* Constructs this class. * Creates and initializes an instance of this abstract class.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
public SubsystemClass() {} protected SubsystemClass() {}
/**
* Contains the {@link LoggerInstance} for this instance.
*
* @see LoggerInstance
* @since v1-alpha0
*/
public final LoggerInstance logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
/** /**
* Returns the name of the subsystem. * Returns the name of the subsystem.

View file

@ -17,9 +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.implementable; package de.staropensource.engine.base.implementable;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;

View file

@ -0,0 +1,256 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base.implementable.helper;
import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.engine.base.EngineInternals;
import de.staropensource.engine.base.annotation.EventListener;
import de.staropensource.engine.base.event.LogEvent;
import de.staropensource.engine.base.exception.reflection.InstanceMethodFromStaticContextException;
import de.staropensource.engine.base.exception.reflection.InvalidMethodSignatureException;
import de.staropensource.engine.base.exception.reflection.NoAccessException;
import de.staropensource.engine.base.exception.reflection.StaticInitializerException;
import de.staropensource.engine.base.implementable.Event;
import de.staropensource.engine.base.implementable.EventListenerCode;
import de.staropensource.engine.base.internal.implementation.EventListenerMethod;
import de.staropensource.engine.base.logging.Logger;
import de.staropensource.engine.base.utility.misc.ListFormatter;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.reflections.Reflections;
import org.reflections.scanners.Scanners;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
/**
* Simplifies event logging and calling.
*
* @since v1-alpha0
*/
@Getter
public final class EventHelper {
/**
* Holds all cached events.
*
* @since v1-alpha5
*/
private static final @NotNull Map<@NotNull Class<? extends Event>, LinkedList<@NotNull EventListenerCode>> cachedEventListeners = new HashMap<>();
/**
* Creates and initializes an instance of this class.
*
* @since v1-alpha0
*/
private EventHelper() {}
/**
* Registers a new {@link Event}.
* <p>
* This method does nothing if classpath searching is disabled.
*
* @param event {@link Event} to register for
* @param eventListener {@link EventListenerCode} to register
* @param priority priority of the listener
* @see EngineInternals#getReflectiveClasspathScanning()
* @since v1-alpha5
*/
public static synchronized void registerEvent(@NotNull Class<? extends Event> event, @NotNull EventListenerCode eventListener, @NotNull Event.Priority priority) {
if (EngineInternals.getInstance().getReflectiveClasspathScanning())
return;
// Update 'eventListener' priority
eventListener.priority = priority;
// Check if event already exists in map
// If not, create entry with a LinkedList
if (cachedEventListeners.containsKey(event))
if (cachedEventListeners.get(event).contains(eventListener))
return;
else
cachedEventListeners.get(event).add(eventListener);
else {
LinkedList<@NotNull EventListenerCode> list = new LinkedList<>();
list.add(eventListener);
cachedEventListeners.put(event, list);
}
Logger.diag("Registered event listener " + eventListener + " for event " + event + " with priority " + priority.name());
}
/**
* Registers a new {@link Event}.
* <p>
* This method does nothing if classpath searching is disabled.
*
* @param event {@link Event} to register for
* @param eventListener {@link EventListenerCode} to register
* @see EngineInternals#getReflectiveClasspathScanning()
* @since v1-alpha5
*/
public static void registerEvent(@NotNull Class<? extends Event> event, @NotNull EventListenerCode eventListener) {
registerEvent(event, eventListener, Event.Priority.DEFAULT);
}
/**
* (Re-)Caches all event listeners for some {@link Event}.
* <p>
* This method does nothing if classpath searching is enabled.
*
* @param event event to (re-)cache. Set to {@code null} to recompute all cached events
* @see EngineInternals#getReflectiveClasspathScanning()
* @since v1-alpha5
*/
public static synchronized void cacheEvent(@Nullable Class<? extends Event> event) {
if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
return;
if (event == null)
for (Class<? extends Event> cachedEvent : cachedEventListeners.keySet())
cacheEvent(cachedEvent);
else {
LinkedList<@NotNull EventListenerCode> annotatedMethods = getAnnotatedMethods(event);
if (cachedEventListeners.containsKey(event))
cachedEventListeners.replace(event, annotatedMethods);
else
cachedEventListeners.put(event, annotatedMethods);
}
}
/**
* Removes an event from the event listener cache.
* <p>
* This method does nothing if classpath searching is enabled.
*
* @param event event to uncache. Set to {@code null} to clear the entire cache
* @see EngineInternals#getReflectiveClasspathScanning()
* @since v1-alpha5
*/
public static synchronized void uncacheEvent(@Nullable Class<? extends Event> event) {
if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
return;
if (event == null)
cachedEventListeners.clear();
else
cachedEventListeners.remove(event);
}
/**
* Invokes all event listeners.
*
* @param event event class
* @param arguments arguments to pass to event listeners
* @since v1-alpha5
*/
public static void invokeAnnotatedMethods(@NotNull Class<? extends Event> event, Object... arguments) {
if (event != LogEvent.class && EngineConfiguration.getInstance().isDebugEvents())
if (arguments.length == 0)
Logger.diag("Event " + event.getName() + " was emitted");
else
Logger.diag("Event " + event.getName() + " was emitted, passing arguments " + ListFormatter.formatArray(arguments));
Runnable eventCode = () -> {
for (EventListenerCode eventListener : getAnnotatedMethods(event)) {
try {
eventListener.run(arguments);
} catch (NoAccessException exception) {
Logger.warn("Event listener " + eventListener + " could not be called as the method could not be accessed");
} catch (InvalidMethodSignatureException exception) {
Logger.warn("Event listener " + eventListener + " has an invalid method signature");
} catch (InvocationTargetException exception) {
Logger.crash("Event listener " + eventListener + " threw a throwable", exception.getTargetException(), true);
} catch (InstanceMethodFromStaticContextException exception) {
Logger.warn("Event listener " + eventListener + " is not static. Event listener methods must be static for them to be called.");
} catch (StaticInitializerException exception) {
Logger.crash("Event listener " + eventListener + " could not be called as the static initializer failed", exception.getThrowable(), true);
} catch (Exception exception) {
Logger.crash("Event listener " + eventListener + " could not be called as an error occurred during reflection", exception, true);
}
}
};
if (EngineConfiguration.getInstance().isOptimizeEvents())
Thread
.ofVirtual()
.name("Event " + event.getName())
.start(eventCode);
else
eventCode.run();
}
/**
* Returns all {@link EventListener}s listening on some event.
* The classpath will be scanned for listeners, unless cached results exist and {@code !forceScanning}.
*
* @param event event class
* @param forceScanning forces scanning the classpath for listeners. not recommended due to a huge performance penalty
* @return list of event listeners
* @see #cacheEvent(Class)
* @since v1-alpha5
*/
public static @NotNull LinkedList<EventListenerCode> getAnnotatedMethods(@NotNull Class<? extends Event> event, boolean forceScanning) {
LinkedList<EventListenerCode> eventListeners = new LinkedList<>();
if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
return Objects.requireNonNullElse(cachedEventListeners.get(event), eventListeners);
if (forceScanning || !cachedEventListeners.containsKey(event)) {
Reflections reflections = new Reflections(
new ConfigurationBuilder()
.setUrls(ClasspathHelper.forJavaClassPath())
.setScanners(Scanners.MethodsAnnotated)
);
// Get annotated methods
Set<@NotNull Method> annotatedMethods = reflections.getMethodsAnnotatedWith(EventListener.class);
// Sort event listeners not listening for the specified event out
for (Method method : annotatedMethods)
if (method.getAnnotation(EventListener.class).event() == event)
eventListeners.add(new EventListenerMethod(method));
// Sort list after event priority
eventListeners.sort(Comparator.comparing(method -> Objects.requireNonNull(((EventListenerMethod) method).getAnnotation(EventListener.class)).priority()));
} else
// Event listeners are cached and !forceScanning, return cached results
eventListeners = cachedEventListeners.get(event);
return eventListeners;
}
/**
* Returns all {@link EventListener}s listening on some event.
* The classpath will be scanned for listeners, unless cached results exist.
*
* @param event event class
* @return list of event listeners
* @since v1-alpha5
*/
public static @NotNull LinkedList<EventListenerCode> getAnnotatedMethods(@NotNull Class<? extends Event> event) {
return getAnnotatedMethods(event, false);
}
}

View file

@ -23,4 +23,4 @@
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
package de.staropensource.sosengine.base.implementable.helper; package de.staropensource.engine.base.implementable.helper;

View file

@ -0,0 +1,25 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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/>.
*/
/**
* Interfaces and abstract classes which can be used for implementing classes.
*
* @since v1-alpha0
*/
package de.staropensource.engine.base.implementable;

View file

@ -0,0 +1,56 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base.implementation.logging;
import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.engine.base.logging.Logger;
import de.staropensource.engine.base.type.logging.LogLevel;
import de.staropensource.engine.base.implementation.shortcode.EmptyShortcodeParser;
import org.jetbrains.annotations.NotNull;
/**
* Prints log messages to the console, without any fancy colors or formatting.
*
* @see Logger
* @see LoggingAdapter
* @since v1-alpha1
*/
public class PlainLoggingAdapter implements LoggingAdapter {
/**
* Creates and initializes an instance of this class.
*
* @since v1-alpha1
*/
public PlainLoggingAdapter() {}
/** {@inheritDoc} */
@Override
public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
format = new EmptyShortcodeParser(format, true).getClean();
if (level == LogLevel.ERROR || level == LogLevel.CRASH)
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isLogForceStandardOutput())
System.out.println(format);
else
System.err.println(format);
else
System.out.println(format);
}
}

View file

@ -17,10 +17,10 @@
* 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.implementation.logging; package de.staropensource.engine.base.implementation.logging;
import de.staropensource.sosengine.base.implementable.LoggingAdapter; import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.type.logging.LogLevel; import de.staropensource.engine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class QuietLoggingAdapter implements LoggingAdapter { public class QuietLoggingAdapter implements LoggingAdapter {
/** /**
* Constructs this class. * Creates and initializes an instance of this class.
* *
* @since v1-alpha4 * @since v1-alpha4
*/ */
@ -40,17 +40,5 @@ public class QuietLoggingAdapter implements LoggingAdapter {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @Nullable String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) { public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {}
return null;
}
/** {@inheritDoc} */
@Override
public @NotNull String postPlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
return format;
}
/** {@inheritDoc} */
@Override
public void print(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {}
} }

View file

@ -17,12 +17,12 @@
* 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.implementation.logging; package de.staropensource.engine.base.implementation.logging;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggingAdapter; import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.sosengine.base.type.logging.LogLevel; import de.staropensource.engine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -36,7 +36,7 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class RawLoggingAdapter implements LoggingAdapter { public class RawLoggingAdapter implements LoggingAdapter {
/** /**
* Constructs this class. * Creates and initializes an instance of this class.
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
@ -44,21 +44,9 @@ public class RawLoggingAdapter implements LoggingAdapter {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @Nullable String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) { public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
return null; // No modifications necessary
}
/** {@inheritDoc} */
@Override
public @NotNull String postPlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
return format; // No modifications necessary
}
/** {@inheritDoc} */
@Override
public void print(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {
if (level == LogLevel.ERROR || level == LogLevel.CRASH) if (level == LogLevel.ERROR || level == LogLevel.CRASH)
if (EngineConfiguration.getInstance().isLoggerForceStandardOutput()) if (EngineConfiguration.getInstance().isLogForceStandardOutput())
System.out.println(format); System.out.println(format);
else else
System.err.println(format); System.err.println(format);

View file

@ -0,0 +1,25 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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/>.
*/
/**
* A set of built-in {@link de.staropensource.engine.base.implementable.LoggingAdapter}s.
*
* @since v1-alpha1
*/
package de.staropensource.engine.base.implementation.logging;

View file

@ -0,0 +1,25 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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/>.
*/
/**
* Implementations for various interfaces and abstract classes.
*
* @since v1-alpha6
*/
package de.staropensource.engine.base.implementation;

View file

@ -17,28 +17,28 @@
* 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.implementation.shortcode; package de.staropensource.engine.base.implementation.shortcode;
import de.staropensource.sosengine.base.implementable.ShortcodeParser; import de.staropensource.engine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.exception.ParserException; import de.staropensource.engine.base.exception.ParserException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Cleans the string of any tags. * Cleans the string of any tags.
* *
* @see ShortcodeParser * @see ShortcodeParser
* @since v1-alpha1 * @since v1-alpha8
*/ */
public final class EmptyShortcodeConverter extends ShortcodeParser { public final class EmptyShortcodeParser extends ShortcodeParser {
/** /**
* Constructs this class. * Creates and initializes an instance of this class.
* *
* @param string string to parse * @param string string to parse
* @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
* @throws ParserException on error * @throws ParserException on error
* @since v1-alpha1 * @since v1-alpha8
*/ */
public EmptyShortcodeConverter(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException { public EmptyShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
super(string, ignoreInvalidEscapes); super(string, ignoreInvalidEscapes);
} }
@ -46,7 +46,7 @@ public final class EmptyShortcodeConverter extends ShortcodeParser {
* Returns the parsed string without any tags. * Returns the parsed string without any tags.
* *
* @return cleaned input string * @return cleaned input string
* @since v1-alpha1 * @since v1-alpha8
*/ */
public @NotNull String getClean() { public @NotNull String getClean() {
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();

View file

@ -22,4 +22,4 @@
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.implementation.shortcode; package de.staropensource.engine.base.implementation.shortcode;

View file

@ -17,12 +17,12 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.misc.StringUtil;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
@ -90,14 +90,15 @@ public final class FourNumberVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a four number-based version string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid
*/ */
public FourNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException { public FourNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
String[] separatorList = new String[]{ ".", "-" }; String[] separatorList = new String[]{ ".", "-" };
String separator = Miscellaneous.getSeparator(versionString, separatorList, 3); String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 3);
// Escape separator or throw error if invalid // Escape separator or throw error if invalid
switch (separator) { switch (separator) {

View file

@ -17,11 +17,11 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
@ -53,7 +53,8 @@ public final class OneNumberVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a one number-based version string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid

View file

@ -17,12 +17,12 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.misc.StringUtil;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -109,14 +109,15 @@ public final class SemanticVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a semantic versioning string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid
*/ */
public SemanticVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException { public SemanticVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
String[] separatorList = new String[]{ "." }; String[] separatorList = new String[]{ "." };
String separator = Miscellaneous.getSeparator(versionString, separatorList, 2); String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 2);
// Escape separator or throw error if invalid // Escape separator or throw error if invalid
switch (separator) { switch (separator) {

View file

@ -17,12 +17,12 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.type.VersionType; import de.staropensource.engine.base.type.VersionType;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -110,7 +110,8 @@ public final class StarOpenSourceVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a StarOpenSource versioning string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid

View file

@ -17,12 +17,12 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.misc.StringUtil;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
@ -78,14 +78,15 @@ public final class ThreeNumberVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a three number-based version string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid
*/ */
public ThreeNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException { public ThreeNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
String[] separatorList = new String[]{ ".", "-" }; String[] separatorList = new String[]{ ".", "-" };
String separator = Miscellaneous.getSeparator(versionString, separatorList, 2); String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 2);
// Escape separator or throw error if invalid // Escape separator or throw error if invalid
switch (separator) { switch (separator) {

View file

@ -17,12 +17,12 @@
* 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.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;
import de.staropensource.sosengine.base.implementable.VersioningSystem; import de.staropensource.engine.base.implementable.VersioningSystem;
import de.staropensource.sosengine.base.exception.versioning.IncompatibleVersioningSystemException; import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException; import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.misc.StringUtil;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
@ -66,14 +66,15 @@ public final class TwoNumberVersioningSystem implements VersioningSystem {
} }
/** /**
* Parses a two number-based version string. * Tries to parse the specified version string
* and if successful, return a new instance.
* *
* @param versionString version string to parse * @param versionString version string to parse
* @throws InvalidVersionStringException if the version string is invalid * @throws InvalidVersionStringException if the version string is invalid
*/ */
public TwoNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException { public TwoNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
String[] separatorList = new String[]{ ".", "-" }; String[] separatorList = new String[]{ ".", "-" };
String separator = Miscellaneous.getSeparator(versionString, separatorList, 1); String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 1);
// Escape separator or throw error if invalid // Escape separator or throw error if invalid
switch (separator) { switch (separator) {

View file

@ -23,4 +23,4 @@
* *
* @since v1-alpha1 * @since v1-alpha1
*/ */
package de.staropensource.sosengine.base.implementation.versioning; package de.staropensource.engine.base.implementation.versioning;

View file

@ -0,0 +1,83 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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.engine.base.internal.implementation;
import de.staropensource.engine.base.implementable.EventListenerCode;
import de.staropensource.engine.base.reflection.Reflect;
import de.staropensource.engine.base.reflection.ReflectionMethod;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
/**
* Interface specifically for executing event listener methods.
*
* @since v1-alpha5
*/
public final class EventListenerMethod extends EventListenerCode {
/**
* Contains the method to call and get.
*
* @since v1-alpha5
*/
private final @NotNull ReflectionMethod method;
/**
* Creates and initializes an instance of this class.
*
* @param method method to execute
* @since v1-alpha5
*/
public EventListenerMethod(@NotNull Method method) {
this.method = Reflect.reflectOn(method);
}
/** {@inheritDoc} */
@Override
public void run(@Nullable Object @NotNull [] arguments) throws Exception {
method.invoke(arguments);
}
/**
* Forwards {@link ReflectionMethod#getAnnotation(Class)}
* to the internal {@link ReflectionMethod} instance.
*
* @param <T> annotation
* @param annotation annotation to get
* @return annotation or {@code null} on error
* @see ReflectionMethod#getAnnotation(Class)
* @since v1-alpha5
*/
public <T extends Annotation> @Nullable T getAnnotation(@NotNull Class<T> annotation) {
try {
return method.getAnnotation(annotation);
} catch (NullPointerException exception) {
return null;
}
}
/** {@inheritDoc} */
@Override
public String toString() {
return "method " + method.getMethod().getDeclaringClass().getName() + "#" + method.getName();
}
}

View file

@ -0,0 +1,25 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* 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/>.
*/
/**
* Interfaces and abstract classes which can be used for implementing classes.
*
* @since v1-alpha5
*/
package de.staropensource.engine.base.internal.implementation;

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.Math; import de.staropensource.engine.base.utility.misc.NumberUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Calendar; import java.util.Calendar;
@ -34,7 +34,7 @@ import java.util.Calendar;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class DateDay implements Placeholder { public final class DateDay implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
@ -43,6 +43,6 @@ public final class DateDay implements Placeholder {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @NotNull 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%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2));
} }
} }

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.Math; import de.staropensource.engine.base.utility.misc.NumberUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Calendar; import java.util.Calendar;
@ -34,7 +34,7 @@ import java.util.Calendar;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class DateMonth implements Placeholder { public final class DateMonth implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
@ -43,6 +43,6 @@ public final class DateMonth implements Placeholder {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @NotNull 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%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2));
} }
} }

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.Math; import de.staropensource.engine.base.utility.misc.NumberUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Calendar; import java.util.Calendar;
@ -34,7 +34,7 @@ import java.util.Calendar;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class DateYear implements Placeholder { public final class DateYear implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
@ -43,6 +43,6 @@ public final class DateYear implements Placeholder {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @NotNull 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%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4));
} }
} }

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineDependencyJansi implements Placeholder { public final class EngineDependencyJansi implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineDependencyLwjgl implements Placeholder { public final class EngineDependencyLwjgl implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineDependencyReflections implements Placeholder { public final class EngineDependencyReflections implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineDependencySlf4j implements Placeholder { public final class EngineDependencySlf4j implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitBranch implements Placeholder { public final class EngineGitBranch implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitHeader implements Placeholder { public final class EngineGitCommitHeader implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitIdLong implements Placeholder { public final class EngineGitCommitIdLong implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitIdShort implements Placeholder { public final class EngineGitCommitIdShort implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeDay implements Placeholder { public final class EngineGitCommitTimeDay implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeHour implements Placeholder { public final class EngineGitCommitTimeHour implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeMinute implements Placeholder { public final class EngineGitCommitTimeMinute implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeMonth implements Placeholder { public final class EngineGitCommitTimeMonth implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeSecond implements Placeholder { public final class EngineGitCommitTimeSecond implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitTimeYear implements Placeholder { public final class EngineGitCommitTimeYear implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommits implements Placeholder { public final class EngineGitCommits implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitterEmail implements Placeholder { public final class EngineGitCommitterEmail implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitCommitterName implements Placeholder { public final class EngineGitCommitterName implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineGitDirty implements Placeholder { public final class EngineGitDirty implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,9 +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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineVersion implements Placeholder { public final class EngineVersion implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,40 +17,30 @@
* 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.internal.implementation.placeholder.crashhandler; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Implements the {@code crash_message} placeholder. * Implements the {@code engine_version_codename} placeholder.
* *
* @see Placeholder * @see Placeholder
* @since v1-alpha0 * @since v1-alpha8
*/ */
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class CrashMessage implements Placeholder { public final class EngineVersionCodename implements Placeholder {
/** /**
* The message to use. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha8
*/ */
@NotNull public EngineVersionCodename() {}
private final String message;
/**
* Constructs this class.
*
* @param message message to use
* @since v1-alpha0
*/
public CrashMessage(@NotNull String message) {
this.message = message;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @NotNull String replace(@NotNull String text) { public @NotNull String replace(@NotNull String text) {
return text.replace("%crash_message%", message); return text.replace("%engine_version_codename%", EngineInformation.getVersioningCodename());
} }
} }

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineVersionFork implements Placeholder { public final class EngineVersionFork implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineVersionType implements Placeholder { public final class EngineVersionType implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineVersionTyperelease implements Placeholder { public final class EngineVersionTyperelease implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class EngineVersionVersion implements Placeholder { public final class EngineVersionVersion implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.JvmInformation; import de.staropensource.engine.base.utility.information.JvmInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class JvmArguments implements Placeholder { public final class JvmArguments implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.JvmInformation; import de.staropensource.engine.base.utility.information.JvmInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class JvmImplementationName implements Placeholder { public final class JvmImplementationName implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

View file

@ -17,10 +17,10 @@
* 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.internal.implementation.placeholder; package de.staropensource.engine.base.internal.implementation.placeholder;
import de.staropensource.sosengine.base.implementable.Placeholder; import de.staropensource.engine.base.implementable.Placeholder;
import de.staropensource.sosengine.base.utility.information.JvmInformation; import de.staropensource.engine.base.utility.information.JvmInformation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public final class JvmImplementationVendor implements Placeholder { public final class JvmImplementationVendor implements Placeholder {
/** /**
* Constructs this class. * Creates and initializes an instance of this event.
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */

Some files were not shown because too many files have changed in this diff Show more