PDA

View Full Version : ResourceSetMessageSource with multiple ResourceManagers


eviloli
01-03-2005, 08:38 AM
Hi,

I tried using the ResourceSetMessageSource with multiple ResourceManagers (build 118) and could not manage to make it work.
It worked when I used only one ResourceManager.
Here is an extract of my config file :

<object name="messageSource" class="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
<property name="ResourceManagers">
<list>
<value>SyfShop.Persistence.Strings, SyfShop.Persistence</value>
<value>SyfShop.Domain.Strings, SyfShop.Domain</value>
<value>SyfShop.Test.Strings, SyfShop.Test</value>
</list>
</property>
</object>

The problem seems to come from the following code in method Resolve() of class ResourceSetMessageSource (line 107) :

currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo, currentResourceSet );
}

The cache does not take care of the ResourceManager. So there is only one cached ResourceManager for one CultureInfo. I modified the code (dirty hack) so that my spring test project could work. Here is the code :

currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo.Name+resourceMgr.BaseName];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo.Name+resourceMgr.BaseName, currentResourceSet );
}

I don't know if it's a bug or if I am misunderstanding the use of ResourceSetMessageSource, that's why I post this comment here.
By the way, I would like to thank you for the great job you're doing (you and the NHibernate guys).

Best Regards,
Olivier.

Mark Pollack
01-04-2005, 04:20 AM
Hi Oliver,

Thanks for reporting this - it certainly seems like a bug. I'll look into it tomorrow! FYI, I been going through the ResourceSet support in the past few days so the timing is perfect. FYI, I just updated the docs and the example program for messages source support which shows chaining of message argument resolution that you may find useful.

Just curious, how did you know it was build 118, the cruisecontrol email hasn't been working ever since we moved offices here....

Cheers,
Mark

eviloli
01-04-2005, 08:41 AM
Hi mark,

I just downloaded the CVS source after the message "SpringNET Build Successful: Build 118" was posted in the "springnet-developer Archives" mailing list at SourceForge. I did not subscribe to this mailing list but I look at it almost every day to see the work in progress !
As you see I was not really sure it was build 118.

Best Regards,
Olivier.

Mark Pollack
01-04-2005, 03:57 PM
Oliver,

Doh! Simple mistake on my part - glad to see it is working. FYI, gmane has also started to archive the list.

http://news.gmane.org/gmane.comp.windows.dotnet.spring.devel

Cheers,
Mark