KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > server > ConfigDir


1 /******************************************************************************
2  * ConfigDir.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.server;
11
12 /**
13  * ConfigDir is a simple class that depends on nothing else
14  * and locates the configuration directory.
15  *
16  * @author Eric Bloch
17  * @version 1.0
18  */

19
20 import java.io.File JavaDoc;
21
22 public class ConfigDir {
23
24     /**
25      * @return the absolute path for the configuration directory
26      * @param home LPS_HOME to be sued if the path is determined
27      * to be relative
28      */

29
30     private static String JavaDoc mDir = null;
31
32     public synchronized static String JavaDoc get(String JavaDoc home) {
33
34         if (mDir != null)
35             return mDir;
36
37         try {
38             mDir = System.getProperty("lps.config.dir.abs");
39             if (mDir != null && !mDir.equals("")) {
40                 return mDir;
41             }
42         } catch (SecurityException JavaDoc t) {
43         }
44
45         try {
46             mDir = System.getProperty("lps.config.dir");
47         } catch (SecurityException JavaDoc t) {
48         }
49
50         if (mDir == null || mDir.equals("")) {
51             mDir = "config";
52         }
53
54         mDir = home + File.separator + "WEB-INF"
55                     + File.separator + "lps"
56                     + File.separator + mDir;
57
58         return mDir;
59     }
60 }
61
62
Popular Tags