struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Günther Wieser ...@exa-online.de>
Subject RESEND: RE: Load message resources from DB???
Date Thu, 31 Mar 2005 20:39:10 GMT
resend because i didn't receive it on the list. sorry if this comes to you
for the second time.

hi,

as it isn't possible to send zip files to the list, i need to copy and paste
the most important things out of our implementation:

the factory is simple:
public class DBPropertyMessageResourcesFactory extends
MessageResourcesFactory {

    /* (non-Javadoc)
     * @see
org.apache.struts.util.MessageResourcesFactory#createResources(java.lang.Str
ing)
     */
    public MessageResources createResources(String config) {
        return new DBPropertyMessageResources(this, config,
this.returnNull);
    }
}

also, the DBMessageResources class is quite simple, here's the most
important method:

   public String getMessage(Locale locale, String key) {
        String result = DBPropertyMessageService.getMessage(locale, key,
returnNull);
        // we need to flush the cache of the super class MessageResource as
we want to have real 	  // dynamic data here (no caches
        // except the one in DBPropertyMessageService)
        formats.clear();
        return result; 
   }

so the REAL thing is happening in DBPropertyMessageService, and this class
just loads everything at startup (static constructor) into a hashmap. we
have implemented the service class in such way that it's the one and only
point where changes to a property have to go. this allows us to change
values during runtime, and even add new key value pairs during runtime
without reloading from the db.
it's also easy to implement a feature that reloads the db entries ater a
given period of time.

kr,
guenther

--
Günther Wieser

creative-it
Guglgasse 6/1/11/1
A-1110 Wien
Austria
http://www.creative-it.com


-----Original Message-----
From: Mick.Knutson@wellsfargo.com [mailto:Mick.Knutson@wellsfargo.com] 
Sent: Wednesday, March 30, 2005 2:52 AM
To: user@struts.apache.org; jason@supernovasoftware.com
Subject: RE: Load message resources from DB???

Even if I could just get some general directions on what method to pull the
data in, and what method to put the data into what type of container.
Just something would be good.

----------
Thanks...
Mick Knutson

Systems Developer
Business Direct Services, Wells Fargo Bank
333 Market Street, SF, CA  94103
(415) 371-2553
Mick.Knutson@wellsfargo.com
MAC A0103-223

"This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose, or take any action based on this message or
any information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message. Thank
you for your cooperation."
----------



-----Original Message-----
From: Jason Long [mailto:supernovasoftw2683@sbcglobal.net]
Sent: Tuesday, March 29, 2005 4:41 PM
To: 'Struts Users Mailing List'
Subject: RE: Load message resources from DB???


I am still waiting for an example of this as well.  I would very much like
to add this feature, but is not critical and I have other things to work on.
If you find an example please let me know.

Thank you for your time,
 
Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com 

-----Original Message-----
From: Mick.Knutson@wellsfargo.com [mailto:Mick.Knutson@wellsfargo.com]
Sent: Tuesday, March 29, 2005 6:38 PM
To: user@struts.apache.org
Subject: RE: Load message resources from DB???

Does anyone ahve any examples of extending the PropertyMessageResources  and
PropertyMessageResources Factory?


-----Original Message-----
From: Daniel Lipofsky [mailto:daniel.lipofsky@bricsnet.com]
Sent: Tuesday, March 15, 2005 1:35 PM
To: Struts Users Mailing List
Cc: jason@supernovasoftware.com
Subject: RE: Load message resources from DB???


Yes, just extend the PropertyMessageResources and overide the
loadLocale() method.  You should extend the factory too and specify the new
factory in struts-config.xml.  Add a method to clear the cache in the
PropertyMessageResources and clear it when the user changes something.
- Dan

> -----Original Message-----
> From: Jason Long [mailto:supernovasoftw2683@sbcglobal.net]
> Sent: Monday, March 14, 2005 11:21 PM
> To: 'Struts Users Mailing List'
> Subject: Load message resources from DB???
> 
> Is it possible to load the message resources from a database instead 
> of a file?  If so can this be done without reloading the entire 
> application?  I would like to let users manage these.
> 
> Thank you for your time,
> 
> Jason Long
> CEO and Chief Software Engineer
> BS Physics, MS Chemical Engineering
> http://www.supernovasoftware.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message