This project has retired. For details please refer to its Attic page.
ResolvingLocaleUrlDefinitionDAO (Tiles 2 2.1.4 API)

org.apache.tiles.definition.dao
Class ResolvingLocaleUrlDefinitionDAO

Package class diagram package ResolvingLocaleUrlDefinitionDAO
java.lang.Object
  extended by org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO
      extended by org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO
          extended by org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO
All Implemented Interfaces:
TilesApplicationContextAware, DefinitionDAO<Locale>, URLReader, Refreshable, RefreshMonitor, Initializable

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: 814502 $ $Date: 2009-09-14 09:14:57 +0200 (lun, 14 set 2009) $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO
CachingLocaleUrlDefinitionDAO.WildcardMapping
 
Field Summary
 
Fields inherited from class org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO
CHECK_REFRESH_INIT_PARAMETER, checkRefresh, locale2definitionMap, localePatternPaths, wildcardHelper
 
Fields inherited from class org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO
applicationContext, lastModifiedDates, reader, sourceURLs
 
Constructor Summary
ResolvingLocaleUrlDefinitionDAO()
           
 
Method Summary
protected  Map<String,Definition> copyDefinitionMap(Map<String,Definition> localeDefsMap)
          Copies the definition map to be passed to a higher level of customization key.
protected  Map<String,Definition> loadParentDefinitions(Locale parentLocale)
          Loads parent definitions, i.e. definitions mapped to a parent locale.
protected  void postDefinitionLoadOperations(Map<String,Definition> localeDefsMap, Locale customizationKey)
          Operations to be done after definitions are loaded.
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.definition.dao.CachingLocaleUrlDefinitionDAO
addWildcardPaths, checkAndloadDefinitions, getDefinition, getDefinitions, init, loadDefinitions, loadDefinitionsFromURLs, loadRawDefinitionsFromURLs, refresh, replace, replaceDefinition, resolveWildcardDefinition, setCheckRefresh
 
Methods inherited from class org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO
addSourceURL, getResourceNames, getResourceString, identifySources, loadDefinitionsFromURL, refreshRequired, setApplicationContext, setReader, setSourceURLs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tiles.definition.RefreshMonitor
refreshRequired
 

Constructor Detail

ResolvingLocaleUrlDefinitionDAO

public ResolvingLocaleUrlDefinitionDAO()
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.

postDefinitionLoadOperations

protected void postDefinitionLoadOperations(Map<String,Definition> localeDefsMap,
                                            Locale customizationKey)
Operations to be done after definitions are loaded.

Overrides:
postDefinitionLoadOperations in class CachingLocaleUrlDefinitionDAO
Parameters:
localeDefsMap - The loaded definitions.
customizationKey - The locale to use when loading URLs.

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 © 2001-2009 Apache Software Foundation. All Rights Reserved.