File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to manage configuration parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to manage configuration parameters" Watch "How to manage configuration parameters" New topic
Author

How to manage configuration parameters

Olivier Scalbert
Greenhorn

Joined: May 07, 2004
Posts: 25
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

Joined: Apr 16, 2008
Posts: 2187
Store the configuration parameters in a relational database.
Olivier Scalbert
Greenhorn

Joined: May 07, 2004
Posts: 25
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

Joined: Feb 20, 2009
Posts: 1
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

Joined: Feb 01, 2005
Posts: 580
Olivier,

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

Regards,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to manage configuration parameters
 
Similar Threads
jboss application deployment order
I need changes of xml file reflecting with out restart tomcat
how to deploy a EAR application in "exploded" mode ?
Obtaining MANIFEST.MF of an EAR
What's the point of an ear file?