Greetings...

I've been trying to figure out a good, simple way to store configuration
data associated with web applications stored in WARs. The goal is something
that is easy to deploy (via WAR) and maintain. I would like to be able to
deploy a new WAR without touching the config info. That way, the container
can handle the WAR automatically and the config data is only touched when it
needs to be changed.

The options I have considered include:

- Store any config data in a DB and access using JDBC. Two problems: Setting
up the DB takes time, and (more importantly) the connect string and driver
info still needs to be stored somewhere.

- Store the config file in <webapp>/WEB-INF. The problem with this is that
it can be overwritten when a new WAR is deployed.

- Store the config file in the directory pointed to by
System.getProperty("user.home"). This concerns me because that is based on
the user.

- Use an absolute path to store the config file. The problem with this is
that different systems are different, especially across different platforms.
So the "absolute" path varies from system to system, and must be specified
in another way.

- Use a system property (-Dconfig.dir) to specify where the config files
are. The problem here is that different servlet containers need to be set up
differently to set the system property.

- Use an InitServlet, with an init-param, to load the config into the
ServletContext. Problem is, the web.xml file needs to be updated everytime
the WAR is deployed.

The way I am leaning right now is to use the user.home property. The
following procedure would be used:

- When a servlet inits, it trys to find the config file in user.home.

- If the file is not there, a warning is logged and a default copy, with
comments, is copied from the WAR to the user.home.

- The config is *not* loaded.

- If the file is there, a config object is instantiated and put in the
servlet context.

Does anyone else have a clever way of handling this issue?

Thanks,

- Paul Philion

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to