Class TextEngine
java.lang.Object
com.ultikits.ultitools.text.internal.TextEngine
- All Implemented Interfaces:
AutoCloseable
Framework-owned registry and rendering engine.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classLifecycle handle for one external publication; a stale handle never acts on a newer owner.static final recordA read-only preparation result: constructing it neither registers nor writes anything.private static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CatalogueLoaderprivate final Loggerprivate final ConcurrentMap<String, TextEngine.Published> private final MessageRendererprivate final LocaleResolverprivate final UltiToolsTranslator -
Constructor Summary
ConstructorsConstructorDescriptionTextEngine(LocaleResolver resolver, Logger logger) Creates an engine over the current locale configuration.TextEngine(LocaleResolver resolver, Logger logger, @Nullable URL codeSource, Path overrideDirectory) Creates and publishes the framework catalogue at startup. -
Method Summary
Modifier and TypeMethodDescription(package private) @Nullable Catalogueprivate static StringcatalogueOwner(String pluginName, boolean external) private voidcheckModulePreparation(String namespace, String pluginName) private voidcheckNamespace(String namespace, String pluginName) voidclose()private static PluginModuleExceptionstatic PluginModuleExceptionexternalConflict(String namespace, String pluginName, String existing) Builds the connection refusal for an already-occupied external message namespace.fallback()Returns the current fallback locale for the retained legacy-language seam.messagesFor(String namespace) Returns a namespace-bound view; lookups always use the latest published snapshot.private static booleanownedBy(TextEngine.Published current, Object owner) prepare(String namespace, String pluginName, @Nullable URL codeSource, Path overrideDirectory, @Nullable String sourceLanguage) Prepares resources using plugin.yml's optional source-language, defaulting to English.prepare(String namespace, String pluginName, @Nullable URL codeSource, Path overrideDirectory, Locale sourceLocale) Parses a module's resources without logging, publishing or changing the filesystem.private TextEngine.PreparedprepareCatalogue(String namespace, String pluginName, @Nullable URL codeSource, Path overrideDirectory, @Nullable String sourceLanguage, boolean external) private TextEngine.PreparedprepareCatalogue(String namespace, String pluginName, @Nullable URL codeSource, Path overrideDirectory, Locale sourceLocale, boolean external) @Nullable TextEngine.PreparedprepareExternal(String pluginName, @Nullable URL codeSource, Path overrideDirectory) Prepares a catalogue only if the external plugin's own JAR supplies a recognized locale file.voidAtomically publishes a prebuilt immutable catalogue, used by framework-internal fixtures.voidpublish(TextEngine.Prepared prepared, Object owner) Publishes accepted module resources, retaining the prior owner until activation succeeds or rolls back.publishExternal(TextEngine.Prepared prepared) Claims an exclusive namespace before bean creation, without writing any files.voidRefreshes the startup/configuration snapshot and reports why its fallback was chosen.private voidreloadOverrides(@Nullable TextEngine.Published current) voidreloadOverrides(String namespace) Reloads a prepared catalogue by replacing the entire immutable snapshot.private static @Nullable TextEngine.PublishedremovePreviousOwner(@Nullable TextEngine.Published current, Object owner) voidRestores the prior catalogue only while the failed instance still owns the current publication.(package private) UltiToolsTranslatorprivate static CatalogueLoader.LoadedwithDiagnostic(CatalogueLoader.Loaded loaded, String message) voidWithdraws an unloading owner, including any retained snapshot of a successfully superseded copy.
-
Field Details
-
published
-
resolver
-
renderer
-
translator
-
loader
-
logger
-
-
Constructor Details
-
TextEngine
Creates an engine over the current locale configuration. -
TextEngine
public TextEngine(LocaleResolver resolver, Logger logger, @Nullable @Nullable URL codeSource, Path overrideDirectory) Creates and publishes the framework catalogue at startup.
-
-
Method Details
-
translator
UltiToolsTranslator translator() -
fallback
Returns the current fallback locale for the retained legacy-language seam. -
reloadLocaleConfiguration
public void reloadLocaleConfiguration()Refreshes the startup/configuration snapshot and reports why its fallback was chosen. -
messagesFor
-
prepare
-
prepare
-
prepareExternal
@Nullable public @Nullable TextEngine.Prepared prepareExternal(String pluginName, @Nullable @Nullable URL codeSource, Path overrideDirectory) Prepares a catalogue only if the external plugin's own JAR supplies a recognized locale file. -
checkModulePreparation
-
prepareCatalogue
-
prepareCatalogue
-
catalogueOwner
-
withDiagnostic
-
publish
Publishes accepted module resources, retaining the prior owner until activation succeeds or rolls back. -
publishExternal
Claims an exclusive namespace before bean creation, without writing any files. -
publish
-
withdraw
-
rollback
-
ownedBy
-
removePreviousOwner
@Nullable private static @Nullable TextEngine.Published removePreviousOwner(@Nullable @Nullable TextEngine.Published current, Object owner) -
reloadOverrides
Reloads a prepared catalogue by replacing the entire immutable snapshot. -
reloadOverrides
-
catalogue
-
checkNamespace
-
externalConflict
public static PluginModuleException externalConflict(String namespace, String pluginName, String existing) Builds the connection refusal for an already-occupied external message namespace. -
conflict
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-