Class StoredBundleControl

  • All Implemented Interfaces:
    org.tentackle.pdo.DomainContextProvider

    public class StoredBundleControl
    extends java.util.ResourceBundle.Control
    implements org.tentackle.pdo.DomainContextProvider
    Bundle control to use stored bundles.
    Used by StoredBundleFactory in modular apps as well as by ResourceBundle in non-modular apps.
    Author:
    harald
    • Field Summary

      • Fields inherited from class java.util.ResourceBundle.Control

        FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected StoredBundle.StoredBundleUDK createUDK​(java.lang.String baseName, java.util.Locale locale)
      Creates the unique domain key to load a stored bundle.
      org.tentackle.pdo.DomainContext getDomainContext()  
      java.util.List<java.lang.String> getFormats​(java.lang.String baseName)  
      static boolean isFallbackToProperties()
      Returns whether properties should be tried if no stored bundle found.
      protected StoredResourceBundle loadStoredBundle​(StoredBundle.StoredBundleUDK key)
      Loads the bundle from storage.
      java.util.ResourceBundle newBundle​(java.lang.String baseName, java.util.Locale locale, java.lang.String format, java.lang.ClassLoader loader, boolean reload)  
      static void setFallbackToProperties​(boolean fallbackToProperties)
      Sets whether properties should be tried if no stored bundle found.
      • Methods inherited from class java.util.ResourceBundle.Control

        getCandidateLocales, getControl, getFallbackLocale, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceName
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.tentackle.pdo.DomainContextProvider

        on, op
    • Constructor Detail

      • StoredBundleControl

        public StoredBundleControl()
    • Method Detail

      • isFallbackToProperties

        public static boolean isFallbackToProperties()
        Returns whether properties should be tried if no stored bundle found.
        Returns:
        true if use resources from properties (default)
      • setFallbackToProperties

        public static void setFallbackToProperties​(boolean fallbackToProperties)
        Sets whether properties should be tried if no stored bundle found.
        Parameters:
        fallbackToProperties - true if use resources from properties, false to throw MissingResourceException
      • getDomainContext

        public org.tentackle.pdo.DomainContext getDomainContext()
        Specified by:
        getDomainContext in interface org.tentackle.pdo.DomainContextProvider
      • getFormats

        public java.util.List<java.lang.String> getFormats​(java.lang.String baseName)
        Overrides:
        getFormats in class java.util.ResourceBundle.Control
      • newBundle

        public java.util.ResourceBundle newBundle​(java.lang.String baseName,
                                                  java.util.Locale locale,
                                                  java.lang.String format,
                                                  java.lang.ClassLoader loader,
                                                  boolean reload)
                                           throws java.lang.IllegalAccessException,
                                                  java.lang.InstantiationException,
                                                  java.io.IOException
        Overrides:
        newBundle in class java.util.ResourceBundle.Control
        Throws:
        java.lang.IllegalAccessException
        java.lang.InstantiationException
        java.io.IOException
      • createUDK

        protected StoredBundle.StoredBundleUDK createUDK​(java.lang.String baseName,
                                                         java.util.Locale locale)
        Creates the unique domain key to load a stored bundle.
        Parameters:
        baseName - the base bundle name of the resource bundle
        locale - the locale
        Returns:
        the unique domain key
      • loadStoredBundle

        protected StoredResourceBundle loadStoredBundle​(StoredBundle.StoredBundleUDK key)
        Loads the bundle from storage.
        Parameters:
        key - the unique domain key
        Returns:
        the stored resource bundle or null if no such bundle in database