litesoft
@ 474
litesoft / trunk / Java / core / Server / src / org / litesoft / configuration / WebInfConfigAccessorLocator.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt package org.litesoft.configuration; import org.litesoft.servlet.WebInfLocator; import java.io.File; public class WebInfConfigAccessorLocator extends ConfigAccessorLocator { public static final String DEFAULT_WEB_INF_PROPERTIES_NAME = "Properties.properties"; public WebInfConfigAccessorLocator(String pAppNameForPropertyFileName) { super( pAppNameForPropertyFileName + ".properties" ); } @Override public ConfigDataAccessor createConfigDataAccessor() { ConfigDataAccessor found = searchForConfigFileInWebInf(); if ( found == null ) { if ( null == (found = searchForConfigFileInFileSystem()) ) { throw unableToLocate(); } } return found; } private ConfigDataAccessor searchForConfigFileInWebInf() { File zWebInfDir = WebInfLocator.getDir(this); if ( zWebInfDir == null ) { return null; } File zFile = new File(zWebInfDir, DEFAULT_WEB_INF_PROPERTIES_NAME); if ( zFile.isFile() ) { return loadConfigAccessorFrom( zFile ); } zFile = new File(zWebInfDir, mRelativeConfigFilePath); if ( zFile.isFile() ) { return loadConfigAccessorFrom( zFile ); } return null; } } |
Commits for litesoft/trunk/Java/core/Server/src/org/litesoft/configuration/WebInfConfigAccessorLocator.java
Revision | Author | Commited | Message |
---|---|---|---|
474 | GeorgeS | Fri 02 Sep, 2011 14:29:50 +0000 | Switch to Properties and eliminate some of the Per App shit |