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

org.apache.tiles.definition
Class UrlDefinitionsFactory

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

public class UrlDefinitionsFactory
extends LocaleDefinitionsFactory
implements Refreshable

DefinitionsFactory implementation that manages Definitions configuration data from URLs, resolving inheritance when the URL is loaded.

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

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

Field Summary
protected  Map<String,Long> lastModifiedDates
          Deprecated. No more used.
protected  DefinitionsReader reader
          Deprecated. No more used.
protected  List<Object> sources
          Deprecated. Use #sourceURLs.
 
Fields inherited from class org.apache.tiles.definition.LocaleDefinitionsFactory
applicationContext, definitionDao, localeResolver
 
Fields inherited from interface org.apache.tiles.definition.DefinitionsFactory
DEFINITION_DAO_INIT_PARAM, DEFINITIONS_CONFIG, LOCALE_RESOLVER_IMPL_PROPERTY, READER_IMPL_PROPERTY
 
Constructor Summary
UrlDefinitionsFactory()
           
 
Method Summary
protected  void addDefinitions(Definitions definitions, TilesRequestContext tilesContext)
          Deprecated. Let the definitions be loaded by a DefinitionDAO.
 void addSource(Object source)
          Deprecated. Use URLReader.addSourceURL(URL).
protected static List<String> calculatePostfixes(Locale locale)
          Deprecated. Use LocaleUtil.calculatePostfixes(Locale) instead.
protected static String concatPostfix(String name, String postfix)
          Deprecated. Use LocaleUtil.concatPostfix(String,String) instead
protected  DefinitionDAO<Locale> createDefaultDefinitionDAO()
          Creates the default definition DAO, if it has not been specified outside.
protected  Definitions createDefinitions()
          Deprecated. Do not use! Deprecated with no replacement.
 Definition getDefinition(String name, TilesRequestContext tilesContext)
          Returns a Definition object that matches the given name and Tiles context.
protected  Definitions getDefinitions()
          Deprecated. Do not use! Deprecated with no replacement.
protected  List<String> getResourceNames(String resourceString)
          Deprecated. Deprecated without replacement.
protected  String getResourceString(Map<String,String> parms)
          Deprecated. Deprecated without replacement.
protected  boolean isContextProcessed(TilesRequestContext tilesContext)
          Deprecated. It always return true.
 Definitions readDefinitions()
          Deprecated. Let the Definitions Factory use it.
 void refresh()
          Refreshes the stored definitions, reloading them.
 boolean refreshRequired()
          Indicates whether the DefinitionsFactory is out of date and needs to be reloaded.
 
Methods inherited from class org.apache.tiles.definition.LocaleDefinitionsFactory
createDefaultLocaleResolver, init, setApplicationContext, setDefinitionDAO, setLocaleResolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sources

protected List<Object> sources
Deprecated. Use #sourceURLs.
Contains the URL objects identifying where configuration data is found.


reader

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


lastModifiedDates

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

Constructor Detail

UrlDefinitionsFactory

public UrlDefinitionsFactory()
Method Detail

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
Overrides:
getDefinition in class LocaleDefinitionsFactory
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.

refresh

public void refresh()
Refreshes the stored definitions, reloading them.

Specified by:
refresh in interface Refreshable

refreshRequired

public boolean refreshRequired()
Indicates whether the DefinitionsFactory is out of date and needs to be reloaded.

Specified by:
refreshRequired in interface RefreshMonitor
Returns:
If the factory needs refresh.

isContextProcessed

@Deprecated
protected boolean isContextProcessed(TilesRequestContext tilesContext)
Deprecated. It always return true.

Indicates whether a given context has been processed or not.

This method can be used to avoid unnecessary synchronization of the DefinitionsFactory in multi-threaded situations. Check the return of isContextProcessed before synchronizing the object and reading locale-specific definitions.

Parameters:
tilesContext - The Tiles context to check.
Returns:
true if the given context has been processed and false otherwise.

addSource

public void addSource(Object source)
Deprecated. Use URLReader.addSourceURL(URL).

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
Overrides:
addSource in class LocaleDefinitionsFactory
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.

createDefaultDefinitionDAO

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

Overrides:
createDefaultDefinitionDAO in class LocaleDefinitionsFactory
Returns:
The default definition DAO.

readDefinitions

@Deprecated
public Definitions readDefinitions()
Deprecated. Let the Definitions Factory use it.

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

Specified by:
readDefinitions in interface DefinitionsFactory
Overrides:
readDefinitions in class LocaleDefinitionsFactory
Returns:
The definitions holder object, filled with base definitions.
Throws:
DefinitionsFactoryException - if an error occurs reading the sources.

getDefinitions

@Deprecated
protected Definitions getDefinitions()
Deprecated. Do not use! Deprecated with no replacement.

Returns the definitions holder object.

Returns:
The definitions holder.

addDefinitions

@Deprecated
protected void addDefinitions(Definitions definitions,
                                         TilesRequestContext tilesContext)
Deprecated. Let the definitions be loaded by a DefinitionDAO.

Appends locale-specific Definition objects to an existing Definitions set by reading locale-specific versions of the applied sources.

Parameters:
definitions - The Definitions object to append to.
tilesContext - The requested locale.
Throws:
DefinitionsFactoryException - if an error occurs reading definitions.

createDefinitions

@Deprecated
protected Definitions createDefinitions()
Deprecated. Do not use! Deprecated with no replacement.

Creates a new instance of Definitions. Override this method to provide your custom instance of Definitions.

Returns:
A new instance of Definitions.

concatPostfix

protected static String concatPostfix(String name,
                                      String postfix)
Deprecated. Use LocaleUtil.concatPostfix(String,String) instead

Concat postfix to the name. Take care of existing filename extension. Transform the given name "name.ext" to have "name" + "postfix" + "ext". If there is no ext, return "name" + "postfix".

Parameters:
name - Filename.
postfix - Postfix to add.
Returns:
Concatenated filename.

calculatePostfixes

protected static List<String> calculatePostfixes(Locale locale)
Deprecated. Use LocaleUtil.calculatePostfixes(Locale) instead.

Calculate the postfixes along the search path from the base bundle to the bundle specified by baseName and locale. Method copied from java.util.ResourceBundle

Parameters:
locale - the locale
Returns:
a list of

getResourceString

@Deprecated
protected String getResourceString(Map<String,String> parms)
Deprecated. Deprecated without replacement.

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

@Deprecated
protected List<String> getResourceNames(String resourceString)
Deprecated. Deprecated without replacement.

Parse the resourceString into a list of resource paths which can be loaded by the application context.

Parameters:
resourceString - comma seperated resources
Returns:
parsed resources


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