org.apache.tiles.impl
Class KeyedDefinitionsFactoryTilesContainer

Package class diagram package KeyedDefinitionsFactoryTilesContainer
java.lang.Object
  extended by org.apache.tiles.impl.BasicTilesContainer
      extended by org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer
All Implemented Interfaces:
org.apache.tiles.TilesContainer
Direct Known Subclasses:
CachingKeyedDefinitionsFactoryTilesContainer

public class KeyedDefinitionsFactoryTilesContainer
extends BasicTilesContainer

Container that can be used to store multiple DefinitionsFactory instances mapped to different keys.


Nested Class Summary
protected  class KeyedDefinitionsFactoryTilesContainer.DefaultKeyExtractor
           
static interface KeyedDefinitionsFactoryTilesContainer.KeyExtractor
           
 
Field Summary
static java.lang.String DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME
          Name of the attribute inside the request that will be used to get the key of the definitions factory to be used.
protected  java.util.Map<java.lang.String,DefinitionsFactory> key2definitionsFactory
          Maps definition factories to their keys.
protected  KeyedDefinitionsFactoryTilesContainer.KeyExtractor keyExtractor
           
 
Fields inherited from class org.apache.tiles.impl.BasicTilesContainer
DEFINITIONS_CONFIG
 
Constructor Summary
KeyedDefinitionsFactoryTilesContainer()
          Constructor.
 
Method Summary
protected  ComponentDefinition getDefinition(java.lang.String definitionName, TilesRequestContext request)
           
 DefinitionsFactory getDefinitionsFactory(java.lang.String key)
          Standard Getter
protected  java.lang.String getDefinitionsFactoryKey(TilesRequestContext request)
          Returns the definitions factory key.
 DefinitionsFactory getProperDefinitionsFactory(java.lang.String key)
          Standard Getter
 void setDefinitionsFactory(java.lang.String key, DefinitionsFactory definitionsFactory, java.util.Map<java.lang.String,java.lang.String> initParameters)
          Set the definitions factory.
 void setKeyExtractor(KeyedDefinitionsFactoryTilesContainer.KeyExtractor keyExtractor)
           
 
Methods inherited from class org.apache.tiles.impl.BasicTilesContainer
checkInit, endContext, endContext, getApplicationContext, getComponentContext, getComponentContext, getContextFactory, getDefinitionsFactory, getPreparerFactory, getResourceNames, getResourceString, getResourceString, init, initializeDefinitionsFactory, isValidDefinition, isValidDefinition, prepare, prepare, render, render, render, setApplicationContext, setContextFactory, setDefinitionsFactory, setPreparerFactory, startContext, startContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME

public static final java.lang.String DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME
Name of the attribute inside the request that will be used to get the key of the definitions factory to be used.

See Also:
Constant Field Values

key2definitionsFactory

protected java.util.Map<java.lang.String,DefinitionsFactory> key2definitionsFactory
Maps definition factories to their keys.


keyExtractor

protected KeyedDefinitionsFactoryTilesContainer.KeyExtractor keyExtractor
Constructor Detail

KeyedDefinitionsFactoryTilesContainer

public KeyedDefinitionsFactoryTilesContainer()
Constructor.

Method Detail

getDefinitionsFactory

public DefinitionsFactory getDefinitionsFactory(java.lang.String key)
Standard Getter

Parameters:
key - The key of the needed definitions factory.
Returns:
the definitions factory used by this container. If the key is not valid, the default factory will be returned.

getProperDefinitionsFactory

public DefinitionsFactory getProperDefinitionsFactory(java.lang.String key)
Standard Getter

Parameters:
key - The key of the needed definitions factory.
Returns:
the definitions factory used by this container. If the key is not valid, null will be returned.

setDefinitionsFactory

public void setDefinitionsFactory(java.lang.String key,
                                  DefinitionsFactory definitionsFactory,
                                  java.util.Map<java.lang.String,java.lang.String> initParameters)
                           throws org.apache.tiles.TilesException
Set the definitions factory. This method first ensures that the container has not yet been initialized.

Parameters:
definitionsFactory - the definitions factory for this instance.
Throws:
org.apache.tiles.TilesException - If something goes wrong during initialization of the definitions factory.

setKeyExtractor

public void setKeyExtractor(KeyedDefinitionsFactoryTilesContainer.KeyExtractor keyExtractor)

getDefinition

protected ComponentDefinition getDefinition(java.lang.String definitionName,
                                            TilesRequestContext request)
                                     throws DefinitionsFactoryException
Overrides:
getDefinition in class BasicTilesContainer
Throws:
DefinitionsFactoryException

getDefinitionsFactoryKey

protected java.lang.String getDefinitionsFactoryKey(TilesRequestContext request)
Returns the definitions factory key.

Parameters:
request - The request object.
Returns:
The needed factory key.