Class TextEngine

java.lang.Object
com.ultikits.ultitools.text.internal.TextEngine
All Implemented Interfaces:
AutoCloseable

@Internal public final class TextEngine extends Object implements AutoCloseable
Framework-owned registry and rendering engine.
  • Field Details

  • Constructor Details

    • TextEngine

      public TextEngine(LocaleResolver resolver, Logger logger)
      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

      public Locale 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

      public Messages messagesFor(String namespace)
      Returns a namespace-bound view; lookups always use the latest published snapshot.
    • prepare

      public TextEngine.Prepared prepare(String namespace, String pluginName, @Nullable @Nullable URL codeSource, Path overrideDirectory, Locale sourceLocale)
      Parses a module's resources without logging, publishing or changing the filesystem.
    • prepare

      public TextEngine.Prepared prepare(String namespace, String pluginName, @Nullable @Nullable URL codeSource, Path overrideDirectory, @Nullable @Nullable String sourceLanguage)
      Prepares resources using plugin.yml's optional source-language, defaulting to English.
    • 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

      private void checkModulePreparation(String namespace, String pluginName)
    • prepareCatalogue

      private TextEngine.Prepared prepareCatalogue(String namespace, String pluginName, @Nullable @Nullable URL codeSource, Path overrideDirectory, @Nullable @Nullable String sourceLanguage, boolean external)
    • prepareCatalogue

      private TextEngine.Prepared prepareCatalogue(String namespace, String pluginName, @Nullable @Nullable URL codeSource, Path overrideDirectory, Locale sourceLocale, boolean external)
    • catalogueOwner

      private static String catalogueOwner(String pluginName, boolean external)
    • withDiagnostic

      private static CatalogueLoader.Loaded withDiagnostic(CatalogueLoader.Loaded loaded, String message)
    • publish

      public void publish(TextEngine.Prepared prepared, Object owner)
      Publishes accepted module resources, retaining the prior owner until activation succeeds or rolls back.
    • publishExternal

      public TextEngine.ExternalCatalogue publishExternal(TextEngine.Prepared prepared)
      Claims an exclusive namespace before bean creation, without writing any files.
    • publish

      public void publish(Catalogue catalogue, Object owner)
      Atomically publishes a prebuilt immutable catalogue, used by framework-internal fixtures.
    • withdraw

      public void withdraw(String namespace, Object owner)
      Withdraws an unloading owner, including any retained snapshot of a successfully superseded copy.
    • rollback

      public void rollback(String namespace, Object owner)
      Restores the prior catalogue only while the failed instance still owns the current publication.
    • ownedBy

      private static boolean ownedBy(TextEngine.Published current, Object owner)
    • removePreviousOwner

      @Nullable private static @Nullable TextEngine.Published removePreviousOwner(@Nullable @Nullable TextEngine.Published current, Object owner)
    • reloadOverrides

      public void reloadOverrides(String namespace)
      Reloads a prepared catalogue by replacing the entire immutable snapshot.
    • reloadOverrides

      private void reloadOverrides(@Nullable @Nullable TextEngine.Published current)
    • catalogue

      @Nullable @Nullable Catalogue catalogue(String namespace)
    • checkNamespace

      private void checkNamespace(String namespace, String pluginName)
    • externalConflict

      public static PluginModuleException externalConflict(String namespace, String pluginName, String existing)
      Builds the connection refusal for an already-occupied external message namespace.
    • conflict

      private static PluginModuleException conflict(String namespace, String pluginName, String existing)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable