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

org.apache.tiles.definition.dao
Class BaseLocaleUrlDefinitionDAO

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

public abstract class BaseLocaleUrlDefinitionDAO
extends Object
implements DefinitionDAO<Locale>, Initializable, TilesApplicationContextAware, RefreshMonitor, URLReader

Base abstract class for a DAO that is based on URLs and locale as a customization key.

Since:
2.1.0
Version:
$Rev: 734996 $ $Date: 2009-01-16 14:27:28 +0100 (ven, 16 gen 2009) $

Field Summary
protected  TilesApplicationContext applicationContext
          The application context.
protected  Map<String,Long> lastModifiedDates
          Contains the dates that the URL sources were last modified.
protected  DefinitionsReader reader
          Reader used to get definitions from the sources.
protected  List<URL> sourceURLs
          Contains the URL objects identifying where configuration data is found.
 
Constructor Summary
BaseLocaleUrlDefinitionDAO()
          Constructor.
 
Method Summary
 void addSourceURL(URL sourceURL)
          Adds a single URL to use.
protected  String[] getResourceNames(String resourceString)
          Parse the resourceString into a list of resource paths which can be loaded by the application context.
protected  String getResourceString(Map<String,String> parms)
          Derive the resource string from the initialization parameters.
protected  void identifySources(Map<String,String> initParameters)
          Detects the sources to load.
 void init(Map<String,String> params)
          Initializes the object.
protected  Map<String,Definition> loadDefinitionsFromURL(URL url)
          Loads definitions from an URL without loading from "parent" URLs.
 boolean refreshRequired()
          Indicates whether the sources are out of date and need to be reloaded.
 void setApplicationContext(TilesApplicationContext applicationContext)
          Sets the Tiles application context.
 void setReader(DefinitionsReader reader)
          Sets the definitions reader that will read the URLs.
 void setSourceURLs(List<URL> sourceURLs)
          Sets the source URLs to use.
 
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.dao.DefinitionDAO
getDefinition, getDefinitions
 

Field Detail

sourceURLs

protected List<URL> sourceURLs
Contains the URL objects identifying where configuration data is found.

Since:
2.1.0

lastModifiedDates

protected Map<String,Long> lastModifiedDates
Contains the dates that the URL sources were last modified.

Since:
2.1.0

applicationContext

protected TilesApplicationContext applicationContext
The application context.

Since:
2.1.0

reader

protected DefinitionsReader reader
Reader used to get definitions from the sources.

Since:
2.1.0
Constructor Detail

BaseLocaleUrlDefinitionDAO

public BaseLocaleUrlDefinitionDAO()
Constructor.

Method Detail

setSourceURLs

public void setSourceURLs(List<URL> sourceURLs)
Sets the source URLs to use.

Specified by:
setSourceURLs in interface URLReader
Parameters:
sourceURLs - The source URLs.

setReader

public void setReader(DefinitionsReader reader)
Sets the definitions reader that will read the URLs.

Specified by:
setReader in interface URLReader
Parameters:
reader - The definitions reader.

addSourceURL

public void addSourceURL(URL sourceURL)
Adds a single URL to use.

Specified by:
addSourceURL in interface URLReader
Parameters:
sourceURL - The source URL to add.

setApplicationContext

public void setApplicationContext(TilesApplicationContext applicationContext)
Sets the Tiles application context.

Specified by:
setApplicationContext in interface TilesApplicationContextAware
Parameters:
applicationContext - The Tiles application context.

init

public void init(Map<String,String> params)
Initializes the object.

Specified by:
init in interface Initializable
Parameters:
params - The map of parameters.

refreshRequired

public boolean refreshRequired()
Indicates whether the sources are out of date and need to be reloaded.

Specified by:
refreshRequired in interface RefreshMonitor
Returns:
true if the sources need to be refreshed.

identifySources

protected void identifySources(Map<String,String> initParameters)
Detects the sources to load.

Parameters:
initParameters - The initialization parameters.
Since:
2.1.0

getResourceString

protected String getResourceString(Map<String,String> parms)
Derive the resource string from the initialization parameters. If no parameter DefinitionsFactory.DEFINITIONS_CONFIG is available, attempts to retrieve BasicTilesContainer.DEFINITIONS_CONFIG and LEGACY_DEFINITIONS_CONFIG. If neither are available, returns "/WEB-INF/tiles.xml".

Parameters:
parms - The initialization parameters.
Returns:
resource string to be parsed.

getResourceNames

protected String[] getResourceNames(String resourceString)
Parse the resourceString into a list of resource paths which can be loaded by the application context.

Parameters:
resourceString - comma separated resources
Returns:
parsed resources

loadDefinitionsFromURL

protected Map<String,Definition> loadDefinitionsFromURL(URL url)
Loads definitions from an URL without loading from "parent" URLs.

Parameters:
url - The URL to read.
Returns:
The definition map that has been read.


Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.