• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to manage configuration parameters

 
Olivier Scalbert
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store the configuration parameters in a relational database.
 
Olivier Scalbert
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
 
Chandu Cheruku
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Olivier,

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

Regards,
Reza
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic