You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <pe...@realityforge.org> on 2003/02/01 00:12:30 UTC

Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

On Sat, 1 Feb 2003 09:55, Stephen McConnell wrote:
> I want the resource object cached but the establishment is directing
> that the cached resource is established with respect to a particular
> locale.  I don't see how this breaks caching because I want the
> behaviour of Resource per class. I simply want to override the default
> establishment of the locale.  Please take another look - I think you
> will find that class caching is working just fine - but I'm interested
> in any specific issues or respective suggestions you may have.

It breaks

r1 = ResourceManager.getResources( X.class, Locale.de );
r2 = ResourceManager.getResources( X.class, Locale.en );
r3 = ResourceManager.getResources( X.class );

and will always return the german resources rather than german, english and 
default locale.

-- 
Cheers,

Peter Donald
*------------------------------------------------*
| You can't wake a person who is pretending      |
|       to be asleep. -Navajo Proverb.           |
*------------------------------------------------* 


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Stephen McConnell <mc...@apache.org>.

Peter Donald wrote:

>On Sat, 1 Feb 2003 11:07, Stephen McConnell wrote:
>  
>
>>The ResourceManager class basically gets established once following
>>which the body of the code invokes operations against the cached
>>resource.  There isn't anything in the ResourceManager currently to
>>reset the locale being used as runtime.
>>    
>>
>
>Locale.setDefault( myNewLocale );
>ResourceManager.clearResourceCache()
>
>  
>

Yep - that would work.

How about you send in a patch documenting this on the ResourceManager class?

Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Peter Donald <pe...@realityforge.org>.
On Sat, 1 Feb 2003 11:07, Stephen McConnell wrote:
> The ResourceManager class basically gets established once following
> which the body of the code invokes operations against the cached
> resource.  There isn't anything in the ResourceManager currently to
> reset the locale being used as runtime.

Locale.setDefault( myNewLocale );
ResourceManager.clearResourceCache()


-- 
Cheers,

Peter Donald
The big mistake that men make is that when they turn thirteen or fourteen and
all of a sudden they've reached puberty, they believe that they like women.
Actually, you're just horny. It doesn't mean you like women any more at
twenty-one than you did at ten.                --Jules Feiffer (cartoonist) 


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Stephen McConnell <mc...@apache.org>.

Noel J. Bergman wrote:

>Stephen,
>
>I agree with Peter that it would be counter-intuitive for
>
>  re = ResourceManager.getResources( X.class, Locale.en )
>
>to return anything other than English resources, just because someone else
>called
>
>  rd = ResourceManager.getResources( X.class, Locale.de );
>
>first.  That just seems broken to me.
>  
>

Broken no - inconsitent yes.
I'll checkout the setting of the gefault locale tomorow and if that 
solves the requirements then I'll backout changes.

>If you are saying that once instantiated with a Locale, then subsequent
>calls that explicitly pass a Locale won't be honored, the least that should
>happen is an exception should be thrown.  That is better than silently
>ignoring the request, and returning the wrong data.
>  
>

What is really needed here is more documentation about the usage of the 
manager and the realtionship to the default locale setting.  With that 
in place then the problem dissapears.  

Cheers, Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Peter Royal <pr...@apache.org>.
On Friday, January 31, 2003, at 07:51  PM, Noel J. Bergman wrote:
> I agree with Peter that it would be counter-intuitive for
>
>   re = ResourceManager.getResources( X.class, Locale.en )
>
> to return anything other than English resources, just because someone 
> else
> called
>
>   rd = ResourceManager.getResources( X.class, Locale.de );
>
> first.  That just seems broken to me.

I agree too. That is non-intuitive behavior.
-pete


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


RE: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by "Noel J. Bergman" <no...@devtech.com>.
Stephen,

I agree with Peter that it would be counter-intuitive for

  re = ResourceManager.getResources( X.class, Locale.en )

to return anything other than English resources, just because someone else
called

  rd = ResourceManager.getResources( X.class, Locale.de );

first.  That just seems broken to me.

If you are saying that once instantiated with a Locale, then subsequent
calls that explicitly pass a Locale won't be honored, the least that should
happen is an exception should be thrown.  That is better than silently
ignoring the request, and returning the wrong data.

> There isn't anything in the ResourceManager currently to
> reset the locale being used as runtime.

Sounds like Peter has a fix for that.  :-)

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Stephen McConnell <mc...@apache.org>.

Peter Donald wrote:

>On Sat, 1 Feb 2003 10:23, Stephen McConnell wrote:
>  
>
>>>It breaks
>>>
>>>r1 = ResourceManager.getResources( X.class, Locale.de );
>>>r2 = ResourceManager.getResources( X.class, Locale.en );
>>>r3 = ResourceManager.getResources( X.class );
>>>
>>>and will always return the german resources rather than german, english
>>>and default locale.
>>>      
>>>
>>That is the intention.
>>    
>>
>
>Seems stupid. I would expect 
>
>ResourceManager.getResources( X.class, Locale.en )
>
>to return english resources myself.
>

The ResourceManager class basically gets established once following 
which the body of the code invokes operations against the cached 
resource.  There isn't anything in the ResourceManager currently to 
reset the locale being used as runtime.  If you want a sepecic resource 
you can do that (as you suggested) using the Resource class.  The 
getBaseResources could be enhanced to check the supplied locale is 
consitent with the cached locale however I think this is unnecessary - 
after all the ResourceManager is intended to provide the cache value as 
a static value and does not need to be changed following initiation.

Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Peter Donald <pe...@realityforge.org>.
On Sat, 1 Feb 2003 10:23, Stephen McConnell wrote:
> >It breaks
> >
> >r1 = ResourceManager.getResources( X.class, Locale.de );
> >r2 = ResourceManager.getResources( X.class, Locale.en );
> >r3 = ResourceManager.getResources( X.class );
> >
> >and will always return the german resources rather than german, english
> > and default locale.
>
> That is the intention.

Seems stupid. I would expect 

ResourceManager.getResources( X.class, Locale.en )

to return english resources myself.

-- 
Cheers,

Peter Donald
------------------------------------
The two secrets to success:
   1- Don't tell anyone everything.
------------------------------------ 


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-avalon-excalibur/i18n/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java

Posted by Stephen McConnell <mc...@apache.org>.

Peter Donald wrote:

>On Sat, 1 Feb 2003 09:55, Stephen McConnell wrote:
>  
>
>>I want the resource object cached but the establishment is directing
>>that the cached resource is established with respect to a particular
>>locale.  I don't see how this breaks caching because I want the
>>behaviour of Resource per class. I simply want to override the default
>>establishment of the locale.  Please take another look - I think you
>>will find that class caching is working just fine - but I'm interested
>>in any specific issues or respective suggestions you may have.
>>    
>>
>
>It breaks
>
>r1 = ResourceManager.getResources( X.class, Locale.de );
>r2 = ResourceManager.getResources( X.class, Locale.en );
>r3 = ResourceManager.getResources( X.class );
>
>and will always return the german resources rather than german, english and 
>default locale.
>  
>

That is the intention.

The only difference is that instead of pulling in the default locale 
into the cache - the implementation can be instructed to pull an 
specific locale resource into the cache. I.e. default locale is the 
system default local unless you provide an overriding locale.  That 
point on the resource manager returns the established locale.  I.e. it's 
not broken.

Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org