|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO
public class CachingLocaleUrlDefinitionDAO
A definitions DAO (loading URLs and using Locale as a customization key) that caches definitions that have been loaded in a raw way (i.e. with inheritance that is not resolved).
It can check if the URLs change, but by default this feature is turned off.
Nested Class Summary | |
---|---|
protected class |
CachingLocaleUrlDefinitionDAO.WildcardMapping
Maps a pattern with a definition in cache. |
Field Summary | |
---|---|
static String |
CHECK_REFRESH_INIT_PARAMETER
Initialization parameter to set whether we want to refresh URLs when they change. |
protected boolean |
checkRefresh
Flag that, when true , enables automatic checking of URLs
changing. |
protected Map<Locale,Map<String,Definition>> |
locale2definitionMap
The locale-specific set of definitions objects. |
protected Map<Locale,List<CachingLocaleUrlDefinitionDAO.WildcardMapping>> |
localePatternPaths
Stores patterns depending on the locale they refer to. |
protected WildcardHelper |
wildcardHelper
An object that helps in resolving definitions with wildcards. |
Fields inherited from class org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO |
---|
applicationContext, lastModifiedDates, reader, sourceURLs |
Constructor Summary | |
---|---|
CachingLocaleUrlDefinitionDAO()
Constructor. |
Method Summary | |
---|---|
protected void |
addWildcardPaths(List<CachingLocaleUrlDefinitionDAO.WildcardMapping> paths,
Map<String,Definition> defsMap)
Adds wildcard paths that are stored inside a normal definition map. |
protected Map<String,Definition> |
checkAndloadDefinitions(Locale customizationKey)
Checks if URLs have changed. |
protected Map<String,Definition> |
copyDefinitionMap(Map<String,Definition> localeDefsMap)
Copies the definition map to be passed to a higher level of customization key. |
Definition |
getDefinition(String name,
Locale customizationKey)
Returns a definition, given its name and the customization key. |
Map<String,Definition> |
getDefinitions(Locale customizationKey)
Returns all the definitions used of a customization key. |
void |
init(Map<String,String> params)
Initializes the object. |
protected Map<String,Definition> |
loadDefinitions(Locale customizationKey)
Tries to load definitions if necessary. |
protected Map<String,Definition> |
loadDefinitionsFromURLs(Locale customizationKey)
Loads definitions from the URLs. |
protected Map<String,Definition> |
loadParentDefinitions(Locale parentLocale)
Loads parent definitions, i.e. definitions mapped to a parent locale. |
protected Map<String,Definition> |
loadRawDefinitionsFromURLs(Locale customizationKey)
Deprecated. Use loadDefinitionsFromURLs(Locale) . |
protected void |
postDefinitionLoadOperations(Map<String,Definition> localeDefsMap,
Locale customizationKey)
Operations to be done after definitions are loaded. |
void |
refresh()
Refreshes the stored definitions, reloading them. |
protected String |
replace(String st,
Map<Integer,String> vars)
Replaces a string with placeholders using values of a variable map. |
protected Definition |
replaceDefinition(Definition d,
String name,
Map<Integer,String> vars)
Creates a definition given its representation with wildcards. |
protected Definition |
resolveWildcardDefinition(List<CachingLocaleUrlDefinitionDAO.WildcardMapping> paths,
String name)
Try to resolve a wildcard definition. |
void |
setCheckRefresh(boolean checkRefresh)
Sets the flag to check URL refresh. |
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 |
Field Detail |
---|
public static final String CHECK_REFRESH_INIT_PARAMETER
protected Map<Locale,Map<String,Definition>> locale2definitionMap
protected boolean checkRefresh
true
, enables automatic checking of URLs
changing.
protected WildcardHelper wildcardHelper
protected Map<Locale,List<CachingLocaleUrlDefinitionDAO.WildcardMapping>> localePatternPaths
Constructor Detail |
---|
public CachingLocaleUrlDefinitionDAO()
Method Detail |
---|
public void init(Map<String,String> params)
init
in interface Initializable
init
in class BaseLocaleUrlDefinitionDAO
params
- The map of parameters.public Definition getDefinition(String name, Locale customizationKey)
getDefinition
in interface DefinitionDAO<Locale>
name
- The name of the definition.customizationKey
- The customization key.
null
.
The inheritance of the definition must not be resolved.public Map<String,Definition> getDefinitions(Locale customizationKey)
getDefinitions
in interface DefinitionDAO<Locale>
customizationKey
- The customization key.
public void refresh()
refresh
in interface Refreshable
public void setCheckRefresh(boolean checkRefresh)
false
.
checkRefresh
- When true
, enables automatic checking
of URLs changing.protected Map<String,Definition> checkAndloadDefinitions(Locale customizationKey)
customizationKey
- The locale to use when loading URLs.
protected Map<String,Definition> loadDefinitions(Locale customizationKey)
customizationKey
- The locale to use when loading URLs.
protected Map<String,Definition> loadDefinitionsFromURLs(Locale customizationKey)
customizationKey
- The locale to use when loading URLs.
protected Map<String,Definition> loadRawDefinitionsFromURLs(Locale customizationKey)
loadDefinitionsFromURLs(Locale)
.
customizationKey
- The locale to use when loading URLs.
protected Map<String,Definition> loadParentDefinitions(Locale parentLocale)
parentLocale
- The locale to use when loading URLs.
protected void postDefinitionLoadOperations(Map<String,Definition> localeDefsMap, Locale customizationKey)
localeDefsMap
- The loaded definitions.customizationKey
- The locale to use when loading URLs.protected void addWildcardPaths(List<CachingLocaleUrlDefinitionDAO.WildcardMapping> paths, Map<String,Definition> defsMap)
paths
- The list containing the currently stored paths.defsMap
- The definition map to parse.protected Definition resolveWildcardDefinition(List<CachingLocaleUrlDefinitionDAO.WildcardMapping> paths, String name)
paths
- The list containing the currently stored paths.name
- The name of the definition to resolve.
null
if not.protected Definition replaceDefinition(Definition d, String name, Map<Integer,String> vars)
d
- The definition to replace.name
- The name of the definition to be created.vars
- The variables to be substituted.
protected String replace(String st, Map<Integer,String> vars)
st
- The string to replace.vars
- The variables.
protected Map<String,Definition> copyDefinitionMap(Map<String,Definition> localeDefsMap)
localeDefsMap
- The map of definition to be copied.
localeDefsMap
itself.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |