geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wilkes <cwilkes-...@ladro.com>
Subject Ability to set per-deployment gbeans?
Date Wed, 17 May 2006 00:00:40 GMT
I have a webapp that I'm going to reuse for several customers and would
like to have the configuration information (customer name, database
schema info, etc) live outside of the webapp.

Normally I would would put this sort of information into the web.xml's
init-param so that I could get it via the ServletContext.  However I
would like to deploy the exact same war for different customers and
don't want to open up the war, add that setting, and the re-create the
war file.

I've tried to find a way to access the configId that I've individually
set for each customer but can't find a way to get at the one that
relates to the webapp that's being deployed -- I query the kernel for a
list of gbeans and I can see all of the other webapps on the geronimo
server.  I have no idea which one is "mine" as they all look the same.

Looking through the archives I found this post:
  http://article.gmane.org/gmane.comp.java.geronimo.user/1418/match=configid
but I'm not sure how to implement it.

It would be handy if I could set some init-params from within my
geronimo-web.xml file as I could grab those out of the ServletContext as
I would give them a defined name ("CUSTOMERID") and in my application I
would do a
  webApplicationContext.getServletContext().getInitParameter("CUSTOMERID")
from within one of my spring classes.

Has anyone else encountered this?

What I'm heading toward doing is having Apache answer requests for
http://customerName.com and then passing those along via ajp13 to the
geronimo server(s) at http://geronimoNNN/customerName .  That webapp
will have an object created by Spring that has a method that returns all
the Properties associated with that particular customerName.  Since this
is needed at startup I can't rely on the HttpServletRequest to get the
context-root as I need to configure everything before the first request
comes in.

I'm thinking a "locally scoped" gbean defined in the geronimo-web.xml
could do this, but my reading of the docs says that gbeans defined in
there can be used by all webapps -- and so I'll have to give each one a
unique name meaning that I can't hardcode in my spring config which one
to look for.

Chris

Mime
View raw message