Rakesh Patel wrote:
Thanks for that Steve. I would like to know more about "having the
webapp load these dynamically
based on their hostname"....
Thanks
Rakesh
1. work out your hostname. easy-ish to do, though multiple network cards
can trick you. gethostbyname() is the
String hostname=java.net.InetAddress.getLocalHost().getHostName();
2. look for a properties resource with that name
string resource="/config/hosts/"+hostname+".properties";
3. load it.
InputStream in;
in=this.getClassloader().getResourceAsStream(resource);
if(in==null) {
//no such resource
}
This design doesnt actually scale that well, for reasons I wont go in to
here. Left as an exercise for the reader. Think about clusters.
Its sometimes better to host settings in a database table or on an LDAP
server; then all the options needed in a WAR are the URL/login info of
the database or LDAP box. But by offloading your options to the
infrastructure, you have just taken them off revision control. So you
cannot rollback a big set of changes, maybe not even audit when
something changed and why. Ops will deny the change leaving the dev team
to field the blame (or vice versa, depending on what changed)
When we use smartfrog (disclaimer, the project I work on) to do
deployments, we keep the set of entire deployment descriptors locked
down in subversion, tagged with releases. So we have different
configurations for different targets, one war file and dynamically
deploy the appserver, the war and the database all in one go. Its
fiddlier to start with, but scales much better. http://smartfrog.org/
-stve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]