org.apache.tiles.factory
Class BasicTilesContainerFactory

Package class diagram package BasicTilesContainerFactory
java.lang.Object
  extended by org.apache.tiles.factory.AbstractTilesContainerFactory
      extended by org.apache.tiles.factory.BasicTilesContainerFactory

public class BasicTilesContainerFactory
extends AbstractTilesContainerFactory

Factory that builds a standard Tiles container using only Java code.

Since:
2.1.0

Field Summary
 
Fields inherited from class org.apache.tiles.factory.AbstractTilesContainerFactory
CONTAINER_FACTORY_INIT_PARAM
 
Constructor Summary
BasicTilesContainerFactory()
           
 
Method Summary
 TilesContainer createContainer(java.lang.Object context)
          Creates a Tiles container.
protected  TilesContextFactory createContextFactory(java.lang.Object context)
          Create a Tiles context factory.
protected  AttributeRenderer createDefaultAttributeRenderer(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, TilesContainer container, AttributeEvaluator evaluator)
          Creates the default attribute renderer.
protected  DefinitionsFactory createDefinitionsFactory(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, LocaleResolver resolver)
          Creates the definitions factory.
protected  DefinitionsReader createDefinitionsReader(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory)
          Creates the definitions reader.
protected  AttributeEvaluator createEvaluator(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, LocaleResolver resolver)
          Creates the attribute evaluator to use.
protected  DefinitionDAO<java.util.Locale> createLocaleDefinitionDao(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, LocaleResolver resolver)
          Creates a Locale-based definition DAO.
protected  LocaleResolver createLocaleResolver(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory)
          Creates the locale resolver.
protected  PreparerFactory createPreparerFactory(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory)
          Creates the preparer factory to use.
protected  RendererFactory createRendererFactory(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, TilesContainer container, AttributeEvaluator evaluator)
          Creates a renderer factory.
protected  java.util.List<java.net.URL> getSourceURLs(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory)
          Returns a list containing the URLs to be parsed.
protected  BasicTilesContainer instantiateContainer(java.lang.Object context)
          Instantiate the container, without initialization.
protected  LocaleDefinitionsFactory instantiateDefinitionsFactory(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, LocaleResolver resolver)
          Instantiate a new definitions factory based on Locale.
protected  BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, LocaleResolver resolver)
          Instantiate (and does not initialize) a Locale-based definition DAO.
protected  void registerAttributeRenderers(BasicRendererFactory rendererFactory, java.lang.Object context, TilesApplicationContext applicationContext, TilesContextFactory contextFactory, TilesContainer container, AttributeEvaluator evaluator)
          Registers attribute renderers in a BasicRendererFactory.
protected  void registerChainedContextFactories(java.lang.Object context, ChainedTilesContextFactory contextFactory)
          Register elements of a chained context factory.
protected  void registerContextFactory(java.lang.String className, java.util.List<TilesContextFactory> factories)
          Registers a TilesContextFactory specifying its classname.
 
Methods inherited from class org.apache.tiles.factory.AbstractTilesContainerFactory
getInitParameter, getInitParameterMap, getTilesContainerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTilesContainerFactory

public BasicTilesContainerFactory()
Method Detail

createContainer

public TilesContainer createContainer(java.lang.Object context)
Creates a Tiles container.

Specified by:
createContainer in class AbstractTilesContainerFactory
Parameters:
context - The (application) context object.
Returns:
The created container.

instantiateContainer

protected BasicTilesContainer instantiateContainer(java.lang.Object context)
Instantiate the container, without initialization.

Parameters:
context - The context object.
Returns:
The instantiated container.
Since:
2.1.0

createContextFactory

protected TilesContextFactory createContextFactory(java.lang.Object context)
Create a Tiles context factory. By default it creates a ChainedTilesContextFactory.

Parameters:
context - The context.
Returns:
The context factory.
Since:
2.1.0

registerChainedContextFactories

protected void registerChainedContextFactories(java.lang.Object context,
                                               ChainedTilesContextFactory contextFactory)
Register elements of a chained context factory.

Parameters:
context - The context.
contextFactory - The context factory to use.
Since:
2.1.0

registerContextFactory

protected void registerContextFactory(java.lang.String className,
                                      java.util.List<TilesContextFactory> factories)
Registers a TilesContextFactory specifying its classname.

Parameters:
className - The name of the class to instantiate.
factories - The list of factories to add to.

createDefinitionsFactory

protected DefinitionsFactory createDefinitionsFactory(java.lang.Object context,
                                                      TilesApplicationContext applicationContext,
                                                      TilesContextFactory contextFactory,
                                                      LocaleResolver resolver)
Creates the definitions factory. By default it creates a UrlDefinitionsFactory with default dependencies.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
resolver - The locale resolver.
Returns:
The definitions factory.
Since:
2.1.0

instantiateDefinitionsFactory

protected LocaleDefinitionsFactory instantiateDefinitionsFactory(java.lang.Object context,
                                                                 TilesApplicationContext applicationContext,
                                                                 TilesContextFactory contextFactory,
                                                                 LocaleResolver resolver)
Instantiate a new definitions factory based on Locale.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
resolver - The locale resolver.
Returns:
The definitions factory.
Since:
2.1.0

instantiateLocaleDefinitionDao

protected BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(java.lang.Object context,
                                                                    TilesApplicationContext applicationContext,
                                                                    TilesContextFactory contextFactory,
                                                                    LocaleResolver resolver)
Instantiate (and does not initialize) a Locale-based definition DAO.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
resolver - The locale resolver.
Returns:
The definition DAO.
Since:
2.1.0

createLocaleDefinitionDao

protected DefinitionDAO<java.util.Locale> createLocaleDefinitionDao(java.lang.Object context,
                                                                    TilesApplicationContext applicationContext,
                                                                    TilesContextFactory contextFactory,
                                                                    LocaleResolver resolver)
Creates a Locale-based definition DAO.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
resolver - The locale resolver.
Returns:
The definition DAO.
Since:
2.1.0

createLocaleResolver

protected LocaleResolver createLocaleResolver(java.lang.Object context,
                                              TilesApplicationContext applicationContext,
                                              TilesContextFactory contextFactory)
Creates the locale resolver. By default it creates a DefaultLocaleResolver.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
Returns:
The locale resolver.

createDefinitionsReader

protected DefinitionsReader createDefinitionsReader(java.lang.Object context,
                                                    TilesApplicationContext applicationContext,
                                                    TilesContextFactory contextFactory)
Creates the definitions reader. By default it creates a DigesterDefinitionsReader.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
Returns:
The definitions reader.

getSourceURLs

protected java.util.List<java.net.URL> getSourceURLs(java.lang.Object context,
                                                     TilesApplicationContext applicationContext,
                                                     TilesContextFactory contextFactory)
Returns a list containing the URLs to be parsed. By default, it returns a list containing the URL point to "/WEB-INF/tiles.xml".

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
Returns:
The source URLs.

createEvaluator

protected AttributeEvaluator createEvaluator(java.lang.Object context,
                                             TilesApplicationContext applicationContext,
                                             TilesContextFactory contextFactory,
                                             LocaleResolver resolver)
Creates the attribute evaluator to use. By default it returns a DirectAttributeEvaluator.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
resolver - The locale resolver.
Returns:
The evaluator.

createPreparerFactory

protected PreparerFactory createPreparerFactory(java.lang.Object context,
                                                TilesApplicationContext applicationContext,
                                                TilesContextFactory contextFactory)
Creates the preparer factory to use. By default it returns a BasicPreparerFactory.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
Returns:
The preparer factory.

createRendererFactory

protected RendererFactory createRendererFactory(java.lang.Object context,
                                                TilesApplicationContext applicationContext,
                                                TilesContextFactory contextFactory,
                                                TilesContainer container,
                                                AttributeEvaluator evaluator)
Creates a renderer factory. By default it returns a BasicRendererFactory, composed of an UntypedAttributeRenderer as default, and StringAttributeRenderer, TemplateAttributeRenderer and DefinitionAttributeRenderer.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
container - The container.
evaluator - The evaluator.
Returns:
The renderer factory.

createDefaultAttributeRenderer

protected AttributeRenderer createDefaultAttributeRenderer(java.lang.Object context,
                                                           TilesApplicationContext applicationContext,
                                                           TilesContextFactory contextFactory,
                                                           TilesContainer container,
                                                           AttributeEvaluator evaluator)
Creates the default attribute renderer. By default it is an UntypedAttributeRenderer.

Parameters:
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
container - The container.
evaluator - The evaluator.
Returns:
The default attribute renderer.

registerAttributeRenderers

protected void registerAttributeRenderers(BasicRendererFactory rendererFactory,
                                          java.lang.Object context,
                                          TilesApplicationContext applicationContext,
                                          TilesContextFactory contextFactory,
                                          TilesContainer container,
                                          AttributeEvaluator evaluator)
Registers attribute renderers in a BasicRendererFactory. By default, it registers a StringAttributeRenderer, a TemplateAttributeRenderer and a DefinitionAttributeRenderer.

Parameters:
rendererFactory - The renderer factory to configure.
context - The context.
applicationContext - The Tiles application context.
contextFactory - The Tiles context factory.
container - The container.
evaluator - The evaluator.