org.apache.tiles.core.definition.dao

## Class ResolvingLocaleUrlDefinitionDAO

- java.lang.Object
- - org.apache.tiles.core.definition.dao.BaseLocaleUrlDefinitionDAO
  - - org.apache.tiles.core.definition.dao.CachingLocaleUrlDefinitionDAO
    - - org.apache.tiles.core.definition.dao.ResolvingLocaleUrlDefinitionDAO

- All Implemented Interfaces:
    DefinitionDAO<Locale>, PatternDefinitionResolverAware<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

- - ### Field Summary

    - ### Fields inherited from class org.apache.tiles.core.definition.dao.CachingLocaleUrlDefinitionDAO

      `CHECK_REFRESH_INIT_PARAMETER, checkRefresh, definitionResolver, locale2definitionMap`

    - ### Fields inherited from class org.apache.tiles.core.definition.dao.BaseLocaleUrlDefinitionDAO

      `applicationContext, lastModifiedDates, reader, sources`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResolvingLocaleUrlDefinitionDAO(ApplicationContext applicationContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Map<String,Definition>` | `copyDefinitionMap(Map<String,Definition> localeDefsMap)` Copies the definition map to be passed to a higher level of customization key.
    `protected Definition` | `getDefinitionFromResolver(String name, Locale customizationKey)` Returns a definition from the definition resolver.
    `protected Map<String,Definition>` | `loadDefinitions(Locale customizationKey)` Tries to load definitions if necessary.
    `protected Map<String,Definition>` | `loadParentDefinitions(Locale parentLocale)` Loads parent definitions, i.e.
    `protected void` | `resolveInheritance(Definition definition, Map<String,Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions)` Resolve locale-specific inheritance.
    `protected void` | `resolveInheritances(Map<String,Definition> map, Locale locale)` Resolve locale-specific extended instances.

    - ### Methods inherited from class org.apache.tiles.core.definition.dao.CachingLocaleUrlDefinitionDAO

      `checkAndloadDefinitions, getDefinition, getDefinitions, loadDefinitionsFromResources, loadRawDefinitionsFromResources, setCheckRefresh, setPatternDefinitionResolver`

    - ### Methods inherited from class org.apache.tiles.core.definition.dao.BaseLocaleUrlDefinitionDAO

      `loadDefinitionsFromResource, refreshRequired, setReader, setSources`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResolvingLocaleUrlDefinitionDAO

          public ResolvingLocaleUrlDefinitionDAO(ApplicationContext applicationContext)

  - ### Method Detail

    - #### loadParentDefinitions

          protected Map<String,Definition> loadParentDefinitions(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.

    - #### loadDefinitions

          protected Map<String,Definition> loadDefinitions(Locale customizationKey)

      Description copied from class: `CachingLocaleUrlDefinitionDAO`
      Tries to load definitions if necessary.
      Overrides:
        `loadDefinitions` in class `CachingLocaleUrlDefinitionDAO`
      Parameters:
        `customizationKey` - The locale to use when loading sources.
      Returns:
        The loaded definitions.

    - #### getDefinitionFromResolver

          protected Definition getDefinitionFromResolver(String name,
                                                         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(Map<String,Definition> map,
                                             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,
                                            Map<String,Definition> definitions,
                                            Locale locale,
                                            Set<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 Map<String,Definition> copyDefinitionMap(Map<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

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.