You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by James Mitchell <jm...@apache.org> on 2005/04/07 18:10:05 UTC

[resources] was: Re: RESEND: RE: Load message resources from DB???

Like many of the Jakarta Commons projects, Commons Resources was based, in 
part, from the initial work done in Struts and later copied over to commons 
with the intent to one day use that library.  This is what was done for 
Beanutils, Digester, Validator, and more I'm sure.

(Craig, correct me if I am wrong here)
MessageResources (the one in Struts) was created because ResourceBundle 
(java api) did not provide the required functionality (at the time it was 
needed).

I have only had a cursory look at Configuration.  From what I know of it, it 
is a reusable library for getting configuration data into your application 
(typically during startup).  Commons Resources is a reusable library for 
retrieving properties pairs (locale aware) for your application.  I do not 
know if Configuration is locale aware, but I suppose Commons Resources could 
be extended (or changed) to use Configuration.

The database extensions I did for Resources are specific to Resources, but 
that can be changed if enough people think we should do that.

I can see how Resources, I18N, and Configuration could play nice together in 
providing i18n'd messages and configuration data.

Would there be any interest in such an animal?



--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring / Freelance
EdgeTech, Inc.
678.910.8017
AIM:   jmitchtx
Yahoo: jmitchtx
MSN:   jmitchell@apache.org




----- Original Message ----- 
From: "Benedict, Paul C" <pa...@merck.com>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>
Sent: Thursday, April 07, 2005 9:59 AM
Subject: RE: RESEND: RE: Load message resources from DB???


> James,
>
> How much different is Common Resources from Common Configuration? In
> essence, a property file is really just a list of configuration pairs.
>
> Thanks,
> Paul
>
> -----Original Message-----
> From: James Mitchell [mailto:jmitchell@apache.org]
> Sent: Wednesday, April 06, 2005 4:22 PM
> To: Struts Users Mailing List
> Subject: Re: RESEND: RE: Load message resources from DB???
>
>
> ----- Original Message ----- 
>> From: "Fogleson, Allen" <al...@daugherty.com>
>> To: "Struts Users Mailing List" <us...@struts.apache.org>;
>> <we...@sonoma.edu>
>> Sent: Wednesday, April 06, 2005 2:40 PM
>> Subject: RE: RESEND: RE: Load message resources from DB???
>>
>>
>> Yes there is the OJBMessageResource class and I believe the same author
>> wrote a HibernateMessageResource class. The class I wrote is mostly a
>> "JNDIJDBCMessageResource" which has a timeout cache attached to it. The
>> config is comprised of three elements (comma separated)
>> 1) The JNDI Name of the datasource to use that maps to a table.
>> 2) The sql to use basically this sql relies on the fact that variable 1 
>> is
>
>> the locale, and variable 2 is the key .
>> 3) The time that the cached value previously retrieved from the DB is
>> valid. If this is 0 timeout is never.
>>
>> The ones mentioned in Bill's book are very good implementations but I 
>> feel
>
>> that it is sometimes nicer to have an implementation that does not add
>> extra class libraries (i.e. OJB or Hibernate). If you are already using
>> one of those in your app I would say then use those Message Resource
>> extensions, but if you want something relatively simple that just uses
>> standard J2EE and the struts libs then use mine. (I really should get it
>> up on a site somewhere :)
>>
>
> Hi, I wrote OJBMessageResources a while back and it has not been updated
> since it was last published.
>
> Struts will soon be changing (1.3.something) the internal mechanism from
> MessageResources/PropertyMessageResources (and factory) to
> commons-resources.  That's why I wrote 3 implementations for
> commons-resources:
> HibernateResources
> IBatisResources
> JDBCResources (not in CVS yet)
>
> http://cvs.sourceforge.net/viewcvs.py/struts/commons-resources-optional/
>
>
> These are not released (because commons-resources has not been released, 
> but
>
> it is out of the sandbox, which is a good thing), but I will publish and
> announce the extensions when it get's the 1.0 stamp of approval.
>
>
>> Al
>
> Thanks.
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> Consulting / Mentoring / Freelance
> EdgeTech, Inc.
> 678.910.8017
> AIM:   jmitchtx
> Yahoo: jmitchtx
> MSN:   jmitchell@apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>
> ------------------------------------------------------------------------------
> Notice:  This e-mail message, together with any attachments, contains 
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New 
> Jersey, USA 08889), and/or its affiliates (which may be known outside the 
> United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as 
> Banyu) that may be confidential, proprietary copyrighted and/or legally 
> privileged. It is intended solely for the use of the individual or entity 
> named on this message.  If you are not the intended recipient, and have 
> received this message in error, please notify us immediately by reply 
> e-mail and then delete it from your system.
> ------------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 



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


Re: [resources] was: Re: RESEND: RE: Load message resources from DB???

Posted by Eric Pugh <ep...@upstate.com>.
As a big user of Configuration, I've thought that it would be quite  
useful in many places.   The flexibility it adds is really useful.   
Configuration isn't specifically locale aware, however, we have  
discussed adding a ConfigurationLocaleAware decorator that would handle  
that.  The Scarab project has it's own logic that takes a Configuration  
and makes it locale aware for i18n purposes for example.

Eric

On Apr 7, 2005, at 12:10 PM, James Mitchell wrote:

> Like many of the Jakarta Commons projects, Commons Resources was  
> based, in part, from the initial work done in Struts and later copied  
> over to commons with the intent to one day use that library.  This is  
> what was done for Beanutils, Digester, Validator, and more I'm sure.
>
> (Craig, correct me if I am wrong here)
> MessageResources (the one in Struts) was created because  
> ResourceBundle (java api) did not provide the required functionality  
> (at the time it was needed).
>
> I have only had a cursory look at Configuration.  From what I know of  
> it, it is a reusable library for getting configuration data into your  
> application (typically during startup).  Commons Resources is a  
> reusable library for retrieving properties pairs (locale aware) for  
> your application.  I do not know if Configuration is locale aware, but  
> I suppose Commons Resources could be extended (or changed) to use  
> Configuration.
>
> The database extensions I did for Resources are specific to Resources,  
> but that can be changed if enough people think we should do that.
>
> I can see how Resources, I18N, and Configuration could play nice  
> together in providing i18n'd messages and configuration data.
>
> Would there be any interest in such an animal?
>
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> Consulting / Mentoring / Freelance
> EdgeTech, Inc.
> 678.910.8017
> AIM:   jmitchtx
> Yahoo: jmitchtx
> MSN:   jmitchell@apache.org
>
>
>
>
> ----- Original Message ----- From: "Benedict, Paul C"  
> <pa...@merck.com>
> To: "'Struts Users Mailing List'" <us...@struts.apache.org>
> Sent: Thursday, April 07, 2005 9:59 AM
> Subject: RE: RESEND: RE: Load message resources from DB???
>
>
>> James,
>>
>> How much different is Common Resources from Common Configuration? In
>> essence, a property file is really just a list of configuration pairs.
>>
>> Thanks,
>> Paul
>>
>> -----Original Message-----
>> From: James Mitchell [mailto:jmitchell@apache.org]
>> Sent: Wednesday, April 06, 2005 4:22 PM
>> To: Struts Users Mailing List
>> Subject: Re: RESEND: RE: Load message resources from DB???
>>
>>
>> ----- Original Message -----
>>> From: "Fogleson, Allen" <al...@daugherty.com>
>>> To: "Struts Users Mailing List" <us...@struts.apache.org>;
>>> <we...@sonoma.edu>
>>> Sent: Wednesday, April 06, 2005 2:40 PM
>>> Subject: RE: RESEND: RE: Load message resources from DB???
>>>
>>>
>>> Yes there is the OJBMessageResource class and I believe the same  
>>> author
>>> wrote a HibernateMessageResource class. The class I wrote is mostly a
>>> "JNDIJDBCMessageResource" which has a timeout cache attached to it.  
>>> The
>>> config is comprised of three elements (comma separated)
>>> 1) The JNDI Name of the datasource to use that maps to a table.
>>> 2) The sql to use basically this sql relies on the fact that  
>>> variable 1 is
>>
>>> the locale, and variable 2 is the key .
>>> 3) The time that the cached value previously retrieved from the DB is
>>> valid. If this is 0 timeout is never.
>>>
>>> The ones mentioned in Bill's book are very good implementations but  
>>> I feel
>>
>>> that it is sometimes nicer to have an implementation that does not  
>>> add
>>> extra class libraries (i.e. OJB or Hibernate). If you are already  
>>> using
>>> one of those in your app I would say then use those Message Resource
>>> extensions, but if you want something relatively simple that just  
>>> uses
>>> standard J2EE and the struts libs then use mine. (I really should  
>>> get it
>>> up on a site somewhere :)
>>>
>>
>> Hi, I wrote OJBMessageResources a while back and it has not been  
>> updated
>> since it was last published.
>>
>> Struts will soon be changing (1.3.something) the internal mechanism  
>> from
>> MessageResources/PropertyMessageResources (and factory) to
>> commons-resources.  That's why I wrote 3 implementations for
>> commons-resources:
>> HibernateResources
>> IBatisResources
>> JDBCResources (not in CVS yet)
>>
>> http://cvs.sourceforge.net/viewcvs.py/struts/commons-resources- 
>> optional/
>>
>>
>> These are not released (because commons-resources has not been  
>> released, but
>>
>> it is out of the sandbox, which is a good thing), but I will publish  
>> and
>> announce the extensions when it get's the 1.0 stamp of approval.
>>
>>
>>> Al
>>
>> Thanks.
>>
>>
>> --
>> James Mitchell
>> Software Engineer / Open Source Evangelist
>> Consulting / Mentoring / Freelance
>> EdgeTech, Inc.
>> 678.910.8017
>> AIM:   jmitchtx
>> Yahoo: jmitchtx
>> MSN:   jmitchell@apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------- 
>> --------
>> Notice:  This e-mail message, together with any attachments, contains  
>> information of Merck & Co., Inc. (One Merck Drive, Whitehouse  
>> Station, New Jersey, USA 08889), and/or its affiliates (which may be  
>> known outside the United States as Merck Frosst, Merck Sharp & Dohme  
>> or MSD and in Japan, as Banyu) that may be confidential, proprietary  
>> copyrighted and/or legally privileged. It is intended solely for the  
>> use of the individual or entity named on this message.  If you are  
>> not the intended recipient, and have received this message in error,  
>> please notify us immediately by reply e-mail and then delete it from  
>> your system.
>> ---------------------------------------------------------------------- 
>> --------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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


Re: [resources] was: Re: RESEND: RE: Load message resources from DB???

Posted by Martin Cooper <mf...@gmail.com>.
On Apr 7, 2005 9:10 AM, James Mitchell <jm...@apache.org> wrote:
> Like many of the Jakarta Commons projects, Commons Resources was based, in
> part, from the initial work done in Struts and later copied over to commons
> with the intent to one day use that library.  This is what was done for
> Beanutils, Digester, Validator, and more I'm sure.
> 
> (Craig, correct me if I am wrong here)
> MessageResources (the one in Struts) was created because ResourceBundle
> (java api) did not provide the required functionality (at the time it was
> needed).

Specifically, ResourceBundle is not Serializable, while
MessageResources is. This was necessary to play nice with some app
servers.

> I have only had a cursory look at Configuration.  From what I know of it, it
> is a reusable library for getting configuration data into your application
> (typically during startup).  Commons Resources is a reusable library for
> retrieving properties pairs (locale aware) for your application.  I do not
> know if Configuration is locale aware, but I suppose Commons Resources could
> be extended (or changed) to use Configuration.
> 
> The database extensions I did for Resources are specific to Resources, but
> that can be changed if enough people think we should do that.
> 
> I can see how Resources, I18N, and Configuration could play nice together in
> providing i18n'd messages and configuration data.
> 
> Would there be any interest in such an animal?

Not from me. I'd rather see us focus on getting Commons Resources to
1.0 first. ;-)

Do people really want localised config files? I'm not sure I see how
it would even work. If I have "debug=true" in English, what would I
have in the German config file? "(debug-in-German)=(true-in-German)"?
How would the code know what to do with that? And please don't make me
debug this stuff! ;-)

--
Martin Cooper


> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> Consulting / Mentoring / Freelance
> EdgeTech, Inc.
> 678.910.8017
> AIM:   jmitchtx
> Yahoo: jmitchtx
> MSN:   jmitchell@apache.org
> 
> ----- Original Message -----
> From: "Benedict, Paul C" <pa...@merck.com>
> To: "'Struts Users Mailing List'" <us...@struts.apache.org>
> Sent: Thursday, April 07, 2005 9:59 AM
> Subject: RE: RESEND: RE: Load message resources from DB???
> 
> > James,
> >
> > How much different is Common Resources from Common Configuration? In
> > essence, a property file is really just a list of configuration pairs.
> >
> > Thanks,
> > Paul
> >
> > -----Original Message-----
> > From: James Mitchell [mailto:jmitchell@apache.org]
> > Sent: Wednesday, April 06, 2005 4:22 PM
> > To: Struts Users Mailing List
> > Subject: Re: RESEND: RE: Load message resources from DB???
> >
> >
> > ----- Original Message -----
> >> From: "Fogleson, Allen" <al...@daugherty.com>
> >> To: "Struts Users Mailing List" <us...@struts.apache.org>;
> >> <we...@sonoma.edu>
> >> Sent: Wednesday, April 06, 2005 2:40 PM
> >> Subject: RE: RESEND: RE: Load message resources from DB???
> >>
> >>
> >> Yes there is the OJBMessageResource class and I believe the same author
> >> wrote a HibernateMessageResource class. The class I wrote is mostly a
> >> "JNDIJDBCMessageResource" which has a timeout cache attached to it. The
> >> config is comprised of three elements (comma separated)
> >> 1) The JNDI Name of the datasource to use that maps to a table.
> >> 2) The sql to use basically this sql relies on the fact that variable 1
> >> is
> >
> >> the locale, and variable 2 is the key .
> >> 3) The time that the cached value previously retrieved from the DB is
> >> valid. If this is 0 timeout is never.
> >>
> >> The ones mentioned in Bill's book are very good implementations but I
> >> feel
> >
> >> that it is sometimes nicer to have an implementation that does not add
> >> extra class libraries (i.e. OJB or Hibernate). If you are already using
> >> one of those in your app I would say then use those Message Resource
> >> extensions, but if you want something relatively simple that just uses
> >> standard J2EE and the struts libs then use mine. (I really should get it
> >> up on a site somewhere :)
> >>
> >
> > Hi, I wrote OJBMessageResources a while back and it has not been updated
> > since it was last published.
> >
> > Struts will soon be changing (1.3.something) the internal mechanism from
> > MessageResources/PropertyMessageResources (and factory) to
> > commons-resources.  That's why I wrote 3 implementations for
> > commons-resources:
> > HibernateResources
> > IBatisResources
> > JDBCResources (not in CVS yet)
> >
> > http://cvs.sourceforge.net/viewcvs.py/struts/commons-resources-optional/
> >
> >
> > These are not released (because commons-resources has not been released,
> > but
> >
> > it is out of the sandbox, which is a good thing), but I will publish and
> > announce the extensions when it get's the 1.0 stamp of approval.
> >
> >
> >> Al
> >
> > Thanks.
> >
> >
> > --
> > James Mitchell
> > Software Engineer / Open Source Evangelist
> > Consulting / Mentoring / Freelance
> > EdgeTech, Inc.
> > 678.910.8017
> > AIM:   jmitchtx
> > Yahoo: jmitchtx
> > MSN:   jmitchell@apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Notice:  This e-mail message, together with any attachments, contains
> > information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
> > Jersey, USA 08889), and/or its affiliates (which may be known outside the
> > United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
> > Banyu) that may be confidential, proprietary copyrighted and/or legally
> > privileged. It is intended solely for the use of the individual or entity
> > named on this message.  If you are not the intended recipient, and have
> > received this message in error, please notify us immediately by reply
> > e-mail and then delete it from your system.
> > ------------------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
>

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


Re: [resources][configuration] was: Re: RESEND: RE: Load message resources from DB???

Posted by Emmanuel Bourg <eb...@apache.org>.
Hi, I agree there is definitely room to mix [resources] and 
[configuration]. Actually I started working on Commons Configuration 
because I wanted a smart resource bundle for a Struts application 
supporting ${variable} interpolation and automatic reloading.

I wrote a ConfigurationMessageResources implementation but it only use 
PropertiesConfiguration. A more generic implementation could bring all 
the formats supported by [configuration] to [resources]. Imagine 
writting a resource file with a .ini file instead of a .properties file, 
it would make the file much more readable, for example:

[page1]

text1=foo
text2=bar

instead of:

page1.text1=foo
page1.text2=bar

But I have to complete my INIConfiguration implementation first ;)

Emmanuel Bourg


James Mitchell wrote:
> Like many of the Jakarta Commons projects, Commons Resources was based, 
> in part, from the initial work done in Struts and later copied over to 
> commons with the intent to one day use that library.  This is what was 
> done for Beanutils, Digester, Validator, and more I'm sure.
> 
> (Craig, correct me if I am wrong here)
> MessageResources (the one in Struts) was created because ResourceBundle 
> (java api) did not provide the required functionality (at the time it 
> was needed).
> 
> I have only had a cursory look at Configuration.  From what I know of 
> it, it is a reusable library for getting configuration data into your 
> application (typically during startup).  Commons Resources is a reusable 
> library for retrieving properties pairs (locale aware) for your 
> application.  I do not know if Configuration is locale aware, but I 
> suppose Commons Resources could be extended (or changed) to use 
> Configuration.
> 
> The database extensions I did for Resources are specific to Resources, 
> but that can be changed if enough people think we should do that.
> 
> I can see how Resources, I18N, and Configuration could play nice 
> together in providing i18n'd messages and configuration data.
> 
> Would there be any interest in such an animal?

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