Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 28998 invoked from network); 24 Oct 2005 15:44:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Oct 2005 15:44:40 -0000 Received: (qmail 97180 invoked by uid 500); 24 Oct 2005 15:44:31 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 97127 invoked by uid 500); 24 Oct 2005 15:44:31 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 97113 invoked by uid 99); 24 Oct 2005 15:44:31 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [192.6.10.60] (HELO tobor.hpl.hp.com) (192.6.10.60) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Oct 2005 08:44:30 -0700 Received: from localhost (localhost [127.0.0.1]) by tobor.hpl.hp.com (Postfix) with ESMTP id 962C137082 for ; Mon, 24 Oct 2005 16:44:06 +0100 (BST) Received: from tobor.hpl.hp.com ([127.0.0.1]) by localhost (tobor.hpl.hp.com [127.0.0.1]) (amavisd-new, port 20024) with LMTP id 20181-04-2 for ; Mon, 24 Oct 2005 16:44:05 +0100 (BST) Received: from kropotkin.hpl.hp.com (kropotkin.hpl.hp.com [15.144.59.2]) by tobor.hpl.hp.com (Postfix) with ESMTP id B278937060 for ; Mon, 24 Oct 2005 16:44:05 +0100 (BST) Received: from localhost (localhost [127.0.0.1]) by kropotkin.hpl.hp.com (Postfix) with ESMTP id 46F3E59C7 for ; Mon, 24 Oct 2005 16:44:05 +0100 (BST) Received: from kropotkin.hpl.hp.com ([127.0.0.1]) by localhost (kropotki [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18149-02-30 for ; Mon, 24 Oct 2005 16:44:04 +0100 (BST) Received: from timmay.hpl.hp.com (timmay-hb.hpl.hp.com [15.144.59.39]) by kropotkin.hpl.hp.com (Postfix) with ESMTP id 814C55CA6 for ; Mon, 24 Oct 2005 16:44:04 +0100 (BST) Received: from [15.144.28.9] (dhcp-28-9.hpl.hp.com [15.144.28.9]) by timmay.hpl.hp.com (8.13.2/8.13.2) with ESMTP id j9OFhx0W027574 for ; Mon, 24 Oct 2005 16:43:59 +0100 (BST) Message-ID: <435D016C.8070504@apache.org> Date: Mon, 24 Oct 2005 16:44:44 +0100 From: Steve Loughran User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Users List Subject: Re: Specifying build properties References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-HPLB-IMAP-MailScanner-Information: Please contact the Helpdesk for more information X-HPLB-IMAP-MailScanner: Found to be clean X-HPLB-IMAP-MailScanner-SpamCheck: not spam, SpamAssassin (score=0, required 5) X-Virus-Scanned: amavisd-new at kropotkin.hpl.hp.com X-Virus-Scanned: amavisd-new at hplb.hpl.hp.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org