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

org.apache.tiles.definition
Class LocaleDefinitionsFactory

Package class diagram package LocaleDefinitionsFactory
java.lang.Object
  extended by org.apache.tiles.definition.LocaleDefinitionsFactory
All Implemented Interfaces:
TilesApplicationContextAware, DefinitionsFactory, Initializable
Direct Known Subclasses:
UrlDefinitionsFactory

public class LocaleDefinitionsFactory
extends Object
implements DefinitionsFactory, TilesApplicationContextAware, Initializable

DefinitionsFactory implementation that manages Definitions configuration data from URLs, but resolving definition inheritance when a definition is returned..

The Definition objects are read from the DigesterDefinitionsReader class unless another implementation is specified.

Since:
2.1.0
Version:
$Rev: 680114 $ $Date: 2008-07-27 16:40:05 +0200 (dom, 27 lug 2008) $

Field Summary
protected  TilesApplicationContext applicationContext
          The application context.
protected  DefinitionDAO<Locale> definitionDao
          The definition DAO that extracts the definitions from the sources.
protected  LocaleResolver localeResolver
          The locale resolver object.
 
Fields inherited from interface org.apache.tiles.definition.DefinitionsFactory
DEFINITION_DAO_INIT_PARAM, DEFINITIONS_CONFIG, LOCALE_RESOLVER_IMPL_PROPERTY, READER_IMPL_PROPERTY
 
Constructor Summary
LocaleDefinitionsFactory()
           
 
Method Summary
 void addSource(Object source)
          Deprecated. 
protected  DefinitionDAO<Locale> createDefaultDefinitionDAO()
          Creates the default definition DAO, if it has not been specified outside.
protected  LocaleResolver createDefaultLocaleResolver()
          Creates the default locale resolver, if it has not been specified outside.
 Definition getDefinition(String name, TilesRequestContext tilesContext)
          Returns a Definition object that matches the given name and Tiles context.
 void init(Map<String,String> params)
          Initializes the DefinitionsFactory and its subcomponents.
 Definitions readDefinitions()
          Deprecated. 
 void setApplicationContext(TilesApplicationContext applicationContext)
          Sets the Tiles application context.
 void setDefinitionDAO(DefinitionDAO<Locale> definitionDao)
          Sets the definition DAO to use.
 void setLocaleResolver(LocaleResolver localeResolver)
          Sets the locale resolver to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definitionDao

protected DefinitionDAO<Locale> definitionDao
The definition DAO that extracts the definitions from the sources.

Since:
2.1.0

applicationContext

protected TilesApplicationContext applicationContext
The application context.

Since:
2.1.0

localeResolver

protected LocaleResolver localeResolver
The locale resolver object.

Constructor Detail

LocaleDefinitionsFactory

public LocaleDefinitionsFactory()
Method Detail

setApplicationContext

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

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

setLocaleResolver

public void setLocaleResolver(LocaleResolver localeResolver)
Sets the locale resolver to use.

Parameters:
localeResolver - The locale resolver.
Since:
2.1.0

setDefinitionDAO

public void setDefinitionDAO(DefinitionDAO<Locale> definitionDao)
Sets the definition DAO to use. It must be locale-based.

Parameters:
definitionDao - The definition DAO.
Since:
2.1.0

init

public void init(Map<String,String> params)
Initializes the DefinitionsFactory and its subcomponents.

Implementations may support configuration properties to be passed in via the params Map.

Specified by:
init in interface DefinitionsFactory
Specified by:
init in interface Initializable
Parameters:
params - The Map of configuration properties.
Throws:
DefinitionsFactoryException - if an initialization error occurs.

getDefinition

public Definition getDefinition(String name,
                                TilesRequestContext tilesContext)
Returns a Definition object that matches the given name and Tiles context.

Specified by:
getDefinition in interface DefinitionsFactory
Parameters:
name - The name of the Definition to return.
tilesContext - The Tiles context to use to resolve the definition.
Returns:
the Definition matching the given name or null if none is found.

addSource

@Deprecated
public void addSource(Object source)
Deprecated. 

Adds a source where Definition objects are stored.

Implementations should publish what type of source object they expect. The source should contain enough information to resolve a configuration source containing definitions. The source should be a "base" source for configurations. Internationalization and Localization properties will be applied by implementations to discriminate the correct data sources based on locale.

Specified by:
addSource in interface DefinitionsFactory
Parameters:
source - The configuration source for definitions.

readDefinitions

@Deprecated
public Definitions readDefinitions()
Deprecated. 

Creates and returns a Definitions set by reading configuration data from the applied sources.

Specified by:
readDefinitions in interface DefinitionsFactory
Returns:
The read definitions.

createDefaultLocaleResolver

protected LocaleResolver createDefaultLocaleResolver()
Creates the default locale resolver, if it has not been specified outside.

Returns:
The default locale resolver.
Since:
2.1.0

createDefaultDefinitionDAO

protected DefinitionDAO<Locale> createDefaultDefinitionDAO()
Creates the default definition DAO, if it has not been specified outside.

Returns:
The default definition DAO.
Since:
2.1.0


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