Re: Properties location
Re: Properties location
- Subject: Re: Properties location
- From: Zak Burke <email@hidden>
- Date: Tue, 26 Apr 2005 10:08:43 -0400
Wolfram Stebel wrote on 4/26/05 4:46 AM:
Hi all,
in deployment, after a split build, the Properties file is located in
myApp.woa.
I use it to configure my application and so the location is not the most
attractive, due to the fact, that development and deployment settings
differ.
Is it possible to declare another location for the Properties file in the
There may be an easier way to do this, but I store the location of a
properties file external to the application (e.g.
/var/webobjects/foo-application.properties) in the application's
properties file (e.g. foo.woa/Content/Resources/Properties) and then
merge the two in an method called from Application's constructor.
This requires your staging and productions servers to have similar
layouts, but it does allow you to have server-specific parameters that
are not overwritten on each deployment.
zak.
private void propertiesInit()
try
{
// look for the "propertiesPath" key. if found, try to open
// that file and copy its properties into System.properties
String string = null;
string = System.getProperty("propertiesPath");
if (string == null || string.equals(""))
string = "Properties";
BufferedInputStream b = new BufferedInputStream(new
FileInputStream(string));
if (b != null)
{
Properties props = new Properties();
props.load(b);
Enumeration e = props.propertyNames();
while (e.hasMoreElements())
{
String key = (String) e.nextElement();
System.setProperty(key, props.getProperty(key));
}
}
}
catch (FileNotFoundException e)
{
NSLog.out.appendln(e.getMessage());
}
catch (IOException e)
{
NSLog.out.appendln(e.getMessage());
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden