You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Peter C. Verhage" <pe...@zeelandnet.nl> on 2001/03/07 19:57:42 UTC

Create your own configuration file

I'm working on a logicsheet which loads a special class which will be cached
for use within other pages which use this class. This class has to read some
configuration data to do certain stuff (create a database connection and
other stuff).

At the moment I've got a special Configuration class in which resides this
configuration data. Ofcourse this is not easy to change, because you have to
edit the class it's source and recompile the class before you can even think
about reloading the servlet engine. Another disadvantage of this method is
that I cannot create a nice JAR package of all the classes the system uses
because the configuration class resides within one of the main packages.

So as you may understand I was looking in a way to read this data from a
configuration file. Ofcourse this doesn't have to be difficult if you
exactly know where to find the configuration file. But I don't want to have
a static location for it, it has go to be specified somewhere in another
configuration file (probably cocoon.properties or in the servlet zone file,
I'm using Apache Jserv at the moment BTW).

In other words I want my class(es) to have a special configuration file, and
get the location of this file somewhere from within the servlet engine. I
don't want to use dirty tricks that send the filename at constructor time of
the class. I just want the class to ask some special (Servlet) class where
the configuration file is. Is there some mechanism within Cocoon that makes
this possible. And if it's possible, how? :) Maybe I can include the
parameters somehow within cocoon.properties, but as you may understand I
don't want to mess with Cocoon it's source to do this because I want to keep
it portable for future Cocoon releases...

Regards,

Peter