2009/4/1 Vibhore Anant <[email protected]>: > I now want to implement a feature where a single Definition can be reloaded > if it has changed. I see that there is a "refresh()" method available on the > UrlDefinitionsFactory class.
This way of refreshing is deprecated. It works only using "TilesFilter" to startup Tiles. > do I have to switch over to writing a custom DefinitionsDAO class in order to > get refresh support? I did look at the source code for the refresh() method > in UrlDefinitionsFactory and it is calling refresh() on a defintionsDAO > object. I haven't provided an implementation, so what is getting called by > default? You can use CachingLocaleUrlDefinitionDAO, together with LocaleDefinitionsFactory, forcing to "true" this parameter in web.xml: org.apache.tiles.definition.dao.LocaleUrlDefinitionDAO.CHECK_REFRESH (not documented, I will open a JIRA issue for this) or, if you are using Java initialization, call "CachingLocaleUrlDefinitionDAO.setCheckRefresh". And yes, you should move definition loading into the DAO. However, are you really sure that you *need* refresh? You can implement your DefinitionDAO without managing caching, using LocaleDefinitionsFactory (that does not cache anything). > Having studied the example in the HOW-TO section, it wasn't entirely > clear what purpose the customisation Key serves. I have no intent to support > localised Definitions - what else could be used as the customisation Key if I > must migrate to this approach instead of the custom DefinitionsReader class I > have now? Think of a portal, in which definitions are customized per user. In this case the customization key is the user. > If anyone can shed some light on what my approach should be to support > refresh of single Definitions, that will be much appreciated. The refresh operation is "global", so you cannot update a single definition. However, as I said before, you can use a variant of LocaleDbDefinitionDAO and LocaleDefinitionsFactory HTH Antonio
