ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package org.jbpm.properties;
 
import java.io.InputStream;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import org.apache.log4j.Logger;
 
public class JBpm4Properties
{
  private static String fileName = "/properties/jbpm4.properties";
  private static ResourceBundle _cfgResourceBundle = null;
 
  static {
    try {
      if (_cfgResourceBundle == null) {
        InputStream is = JBpm4Properties.class.getResourceAsStream(fileName);
        if (is != null)
        {
          _cfgResourceBundle = new PropertyResourceBundle(is);
        }
      }
    } catch (Exception ee) {
      ee.printStackTrace();
    }
  }
 
  public static String getStringProperty(String strKey) {
    return getStrPro(_cfgResourceBundle, strKey);
  }
 
  public static String getStringProperty(String strKey, String defaultVal)
  {
    return getStrPro(_cfgResourceBundle, strKey, defaultVal);
  }
 
  public static int getIntProperty(String strKey)
  {
    return getIntPro(_cfgResourceBundle, strKey);
  }
 
  public static int getIntProperty(String strKey, int defaultVal)
  {
    return getIntPro(_cfgResourceBundle, strKey, defaultVal);
  }
 
  private static String getStrPro(ResourceBundle _cfgResourceBundle, String key) {
    try {
      return _cfgResourceBundle.getString(key).trim();
    } catch (Exception e) {
      e.printStackTrace();
    }return "";
  }
 
  private static String getStrPro(ResourceBundle _cfgResourceBundle, String key, String defaultVal)
  {
    try {
      return _cfgResourceBundle.getString(key).trim();
    } catch (Exception e) {
      e.printStackTrace();
    }return defaultVal;
  }
 
  private static int getIntPro(ResourceBundle _cfgResourceBundle, String key)
  {
    try {
      return Integer.valueOf(_cfgResourceBundle.getString(key).trim()).intValue(); } catch (Exception e) {
    }
    return -1;
  }
 
  private static int getIntPro(ResourceBundle _cfgResourceBundle, String key, int defaultVal)
  {
    try {
      return Integer.valueOf(_cfgResourceBundle.getString(key).trim()).intValue();
    } catch (Exception e) {
      e.printStackTrace();
    }return defaultVal;
  }
}