You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Vibhore Anant <vi...@yahoo.com> on 2009/05/04 19:23:29 UTC
Re: Support for reloading/refreshing Tile Definitions
Hi Antonio,
Sorry for not following this through earlier due to unavoidable circumstances. I have resumed my task of try to implement reloading of Tiles Definitons from the database. To summarise, I have implemented DbDefinitionDAO class and DbTilesContainerFactory class. The DbTilesContainerFactory is defined as:
public class DbTilesContainerFactory extends BasicTilesContainerFactory {
protected DefinitionDAO<Locale> createLocaleDefinitionDao(Object context,
TilesApplicationContext applicationContext,
TilesRequestContextFactory contextFactory,
LocaleResolver resolver) {
DbDefinitionDAO definitionDao = new DbDefinitionDAO();
return definitionDao;
}
protected LocaleDefinitionsFactory instantiateDefinitionsFactory(
Object context, TilesApplicationContext applicationContext,
TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
return new LocaleDefinitionsFactory();
}
}
Here is the output from Log4J (after my app server has started):
2009-05-04 12:59:49,132 INFO [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.k
ernel.Default (self-tuning)'] AbstractTilesApplicationContextFactory - Initializ
ing Tiles2 application context. . .
2009-05-04 12:59:49,147 INFO [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.k
ernel.Default (self-tuning)'] AbstractTilesApplicationContextFactory - Finished
initializing Tiles2 application context.
2009-05-04 12:59:49,210 DEBUG [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.
kernel.Default (self-tuning)'] UrlDefinitionsFactory - Updating Tiles definition
s. . .
2009-05-04 12:59:49,226 INFO [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.k
ernel.Default (self-tuning)'] TilesAccess - Publishing TilesContext for context:
org.apache.tiles.servlet.context.ServletTilesApplicationContext
I don't see an exception, but I do not understand why the UrlDefinitionsFactory is being used to load the TilesDefinitions instead of the LocaleDefinitionsFactory. My Tiles Servlet is configured in web.xml like this:
<servlet id="Servlet_tiles">
<servlet-name>tiles</servlet-name>
<servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
<init-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>
/WEB-INF/tiles-defs.xml
</param-value>
</init-param>
<init-param>
<param-name>
org.apache.tiles.factory.AbstractTilesContainerFactory
</param-name>
<param-value>
com.xyz.DbTilesContainerFactory
</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
I think I did notice is that I need to have an entry for the BasicTilesContainer.DEFINITIONS_CONFIG param, otherwise I get an exception during startup. My tiles-defs.xml file is empty.
I have an earlier implementation based on a DefinitionsReader working successfully where I load definitions from the Database. I wish to use the DAO approach as I need to be able to refresh definitions on the fly.
Regards
Vibhore
--- On Mon, 4/6/09, Antonio Petrelli <an...@gmail.com> wrote:
From: Antonio Petrelli <an...@gmail.com>
Subject: Re: Support for reloading/refreshing Tile Definitions
To: users@tiles.apache.org
Date: Monday, April 6, 2009, 7:35 PM
2009/4/6 Vibhore Anant <vi...@yahoo.com>:
> I can confirm that the AbstractTilesContainerFactory constructor creates an instance of the DbTilesFactoryContainer, however NEITHER of its two methods
> [ instantiateDefinitionsFactory() and createLocaleDefinitionDao() ] are invoked.
This is strange, probably an exception happened.
Can you turn on log4j DEBUG logging for "org.apache.tiles" and post
the log here?
Antonio