tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: Support for reloading/refreshing Tile Definitions
Date Wed, 01 Apr 2009 20:38:26 GMT
2009/4/1 Vibhore Anant <vibhore_anant@yahoo.com>:
> You indicated that I can use CachingLocaleUrlDefinitionDAO with a parameter configured
in web.xml to support a refresh of definitions.  I assume this DAO is for the case when loading
definitions from tiles-defs.xml.  I suppose that since I need to load definitions from the
database I will _have_ to write a custom DefinitionDAO?

Uh right, sure. Create your DAO and implement "Refreshable" (of
Tiles). Manage refreshing when calling "getDefinition" or
"getDefinitions".
Take a look at CachingLocaleUrlDefinitionDAO to check how to do it.
However, it is hard to know when the definition list has been updated,
this is left to the developer. For example, you could intercept all
updates to the Tiles-related tables and set a flag that indicates that
the definition list needs an update.

>  I am still unclear on how to implement a "refresh" for a LocaleDbDefinitionDAO - where
will the code for the "refresh" action be implemented?

Implemented in "refresh" and "refreshRequired", called in
"getDefinition" or "getDefinitions".
In other words, the Definition DAO refreshes itself when needed.

> If I move to using DefinitionDAO without managing caching, my fear is that I will introduce
hundreds of new database calls for my web application.  Am I correct in understanding that
if caching is not used, every attempt to insert a tiles definition on a JSP will result in
database lookups for the definition (and attributes)?

Right, but is it a problem? If you put definitions in a DB it means
that they can be updated and customized during execution.

> I only have one set of global definitions for the web application.  What do you recommend
I use as my customisation key?

Use "Locale", but simply ignore it in the implementation.

Antonio

Mime
View raw message