comparison software/mpdl-services-new/mpiwg-mpdl-cms/src/de/mpg/mpiwg/berlin/mpdl/cms/general/Constants.java @ 25:e9fe3186670c default tip

letzter Stand eingecheckt
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 21 May 2013 10:19:32 +0200
parents
children
comparison
equal deleted inserted replaced
23:e845310098ba 25:e9fe3186670c
1 package de.mpg.mpiwg.berlin.mpdl.cms.general;
2
3 import java.net.URL;
4 import java.util.Properties;
5
6 import de.mpg.mpiwg.berlin.mpdl.util.Util;
7
8 public class Constants {
9 private static Constants instance;
10 private Properties properties;
11
12 public static Constants getInstance() {
13 if (instance == null) {
14 instance = new Constants();
15 instance.init();
16 }
17 return instance;
18 }
19
20 private void init() {
21 URL url = Constants.class.getClassLoader().getResource("constants.properties");
22 if (url != null) {
23 String propertiesFileName = url.toString().substring(5);
24 properties = (new Util()).getProperties(propertiesFileName);
25 }
26 }
27
28 public String getDocumentsDir() {
29 if (properties != null)
30 return properties.getProperty("documentsDir");
31 else
32 return "no properties file";
33 }
34
35 public String getLuceneDocumentsDir() {
36 if (properties != null)
37 return properties.getProperty("luceneDocumentsDir");
38 else
39 return "no properties file";
40 }
41
42 public String getLuceneNodesDir() {
43 if (properties != null)
44 return properties.getProperty("luceneNodesDir");
45 else
46 return "no properties file";
47 }
48
49 public String getConfDir() {
50 if (properties != null)
51 return properties.getProperty("confDir");
52 else
53 return "no properties file";
54 }
55 }