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

org.apache.tiles.definition
Interface DefinitionsFactory

Package class diagram package DefinitionsFactory
All Known Implementing Classes:
UrlDefinitionsFactory

public interface DefinitionsFactory

Interface for creating a Definitions object and managing its contents.

DefinitionsFactory implementations are responsible for maintaining the data sources of Tiles configuration data and using the data to create Definitions sets. Implementations also know how to append locale-specific configuration data to an existing Definitions set.

Version:
$Rev: 537196 $ $Date: 2007-05-11 16:07:35 +0200 (Fri, 11 May 2007) $

Field Summary
static String LOCALE_RESOLVER_IMPL_PROPERTY
          Property name that specifies the implementation of LocaleResolver.
static String READER_IMPL_PROPERTY
          Property name that specifies the implementation of the DefinitionsReader.
 
Method Summary
 void addSource(Object source)
          Adds a source where Definition objects are stored.
 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()
          Creates and returns a Definitions set by reading configuration data from the applied sources.
 

Field Detail

READER_IMPL_PROPERTY

static final String READER_IMPL_PROPERTY
Property name that specifies the implementation of the DefinitionsReader.

See Also:
Constant Field Values

LOCALE_RESOLVER_IMPL_PROPERTY

static final String LOCALE_RESOLVER_IMPL_PROPERTY
Property name that specifies the implementation of LocaleResolver.

See Also:
Constant Field Values
Method Detail

init

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

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

Parameters:
params - The Map of configuration properties.
Throws:
TilesException - If a Tiles exception, such as an initialization error, occurs.

getDefinition

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

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.
Throws:
DefinitionsFactoryException - if an error occurs reading definitions.

addSource

void addSource(Object source)
               throws DefinitionsFactoryException
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.

Parameters:
source - The configuration source for definitions.
Throws:
DefinitionsFactoryException - if an invalid source is passed in or an error occurs resolving the source to an actual data store.

readDefinitions

Definitions readDefinitions()
                            throws DefinitionsFactoryException
Creates and returns a Definitions set by reading configuration data from the applied sources.

Returns:
The read definitions.
Throws:
DefinitionsFactoryException - if an error occurs reading the sources.


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