• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to manage configuration parameters

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

We are writing a JSF web app + some session beans. The jars and wars are packaged inside an ear file.
In this application, they are some configuration parameters that will perhaps change in the future, as directories locations, mail addresses, etc, ...
I do not want to hard-code theses values. I want to put them in a property file or something like that, but outside the ear file, in order to avoid rebuild it in case of change. Is it the good approach ? Are they any other options ?
We are using glassfish.

Thanks,

Olivier
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Store the configuration parameters in a relational database.
 
Olivier Scalbert
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that is a good idea !

But in case I have less then 10 parameters, is not it a little bit too overkill? But then what can be another alternative ?

Olivier
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you move resources outside your application, it could be very hard to maintain in future.

Other approaches -

1. DB is a very good option.
2. If you dont want to go with DB, write a thread which will reload your properties from your configuration file every n seconds.
3. You can set your configuration details as custom properties on your server container.

Hope this helps.
 
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Olivier,

Another option is EJB environment entries that are in the XML DD (ejb-jar.xml).

Regards,
Reza
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic