Subversion Repository Public Repository

litesoft

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
50
// This Source Code is in the Public Domain per: http://unlicense.org
package org.litesoft.configuration;

import java.io.*;

import org.litesoft.servlet.*;

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

Diff revisions: vs.
Revision Author Commited Message
947 Diff Diff GeorgeS picture GeorgeS Fri 06 Jun, 2014 23:36:56 +0000

Correct Spelling of package!

475 Diff Diff GeorgeS picture GeorgeS Sat 03 Sep, 2011 13:54:51 +0000
474 GeorgeS picture GeorgeS Fri 02 Sep, 2011 14:29:50 +0000

Switch to Properties and eliminate some of the Per App shit