Class ResolvingLocaleUrlDefinitionDAO

  • All Implemented Interfaces:
    DefinitionDAO<java.util.Locale>, PatternDefinitionResolverAware<java.util.Locale>, RefreshMonitor

    public class ResolvingLocaleUrlDefinitionDAO
    extends CachingLocaleUrlDefinitionDAO

    A definitions DAO (loading URLs and using Locale as a customization key) that caches definitions that have been loaded and resolves inheritances.

    It can check if the URLs change, but by default this feature is turned off.

    Since:
    2.1.0
    Version:
    $Rev: 1297705 $ $Date: 2012-03-07 07:44:30 +1100 (Wed, 07 Mar 2012) $
    • Constructor Detail

      • ResolvingLocaleUrlDefinitionDAO

        public ResolvingLocaleUrlDefinitionDAO​(org.apache.tiles.request.ApplicationContext applicationContext)
    • Method Detail

      • loadParentDefinitions

        protected java.util.Map<java.lang.String,​Definition> loadParentDefinitions​(java.util.Locale parentLocale)
        Loads parent definitions, i.e. definitions mapped to a parent locale.
        Overrides:
        loadParentDefinitions in class CachingLocaleUrlDefinitionDAO
        Parameters:
        parentLocale - The locale to use when loading URLs.
        Returns:
        The loaded parent definitions.
      • getDefinitionFromResolver

        protected Definition getDefinitionFromResolver​(java.lang.String name,
                                                       java.util.Locale customizationKey)
        Returns a definition from the definition resolver.
        Overrides:
        getDefinitionFromResolver in class CachingLocaleUrlDefinitionDAO
        Parameters:
        name - The name of the definition.
        customizationKey - The customization key to use.
        Returns:
        The resolved definition.
      • resolveInheritances

        protected void resolveInheritances​(java.util.Map<java.lang.String,​Definition> map,
                                           java.util.Locale locale)
        Resolve locale-specific extended instances.
        Parameters:
        map - The definition map containing the definitions to resolve.
        locale - The locale to use.
        Throws:
        NoSuchDefinitionException - If a parent definition is not found.
        Since:
        2.1.0
      • resolveInheritance

        protected void resolveInheritance​(Definition definition,
                                          java.util.Map<java.lang.String,​Definition> definitions,
                                          java.util.Locale locale,
                                          java.util.Set<java.lang.String> alreadyResolvedDefinitions)
        Resolve locale-specific inheritance. First, resolve parent's inheritance, then set template to the parent's template. Also copy attributes setted in parent, and not set in child If instance doesn't extend anything, do nothing.
        Parameters:
        definition - The definition to resolve
        definitions - The definitions to take when obtaining a parent definition.
        locale - The locale to use.
        alreadyResolvedDefinitions - The set of the definitions that have been already resolved.
        Throws:
        NoSuchDefinitionException - If an inheritance can not be solved.
        Since:
        2.1.0
      • copyDefinitionMap

        protected java.util.Map<java.lang.String,​Definition> copyDefinitionMap​(java.util.Map<java.lang.String,​Definition> localeDefsMap)
        Copies the definition map to be passed to a higher level of customization key.
        Overrides:
        copyDefinitionMap in class CachingLocaleUrlDefinitionDAO
        Parameters:
        localeDefsMap - The map of definition to be copied.
        Returns:
        The copy of the definition map. This particular implementation deep-copies the localeDefsMap into a LinkedHashMap.
        Since:
        2.1.4