1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
package net.sf.infrared.web.util; |
24 |
|
|
25 |
|
import org.apache.log4j.Logger; |
26 |
|
|
27 |
|
import net.sf.infrared.base.util.LoggingFactory; |
28 |
|
|
29 |
0 |
public class WebConfig { |
30 |
|
|
31 |
|
public static final String COLLECTOR_PERSIST_INTERVAL = "persist-interval"; |
32 |
|
public static final String WEB_COLOR_THRESHOLD = "web.color-threshold"; |
33 |
|
public static final String WEB_NUM_OF_SQL_QUERIES = "web.num_of_sql_queries"; |
34 |
|
|
35 |
|
public static final String DEFAULT_WEB_CONFIG_LOCATION = "infrared-web.properties"; |
36 |
|
|
37 |
|
public static final String DEFAULT_COLLECTOR_PERSIST_INTERVAL = "600000"; |
38 |
|
public static final String DEFAULT_WEB_COLOR_THRESHOLD = "25"; |
39 |
|
public static final String DEFAULT_NUM_OF_LAST_INVOCATIONS = "5"; |
40 |
|
public static final String DEFAULT_NUM_OF_SQL_QUERIES = "5"; |
41 |
|
|
42 |
0 |
public static Logger log = LoggingFactory.getLogger(WebConfig.class); |
43 |
|
private static PropertyUtil propertyUtil; |
44 |
|
|
45 |
|
static{ |
46 |
0 |
propertyUtil = new PropertyUtil(DEFAULT_WEB_CONFIG_LOCATION); |
47 |
0 |
} |
48 |
|
|
49 |
|
public static long getPersistInterval(){ |
50 |
0 |
String interval = propertyUtil.getProperty(COLLECTOR_PERSIST_INTERVAL, |
51 |
|
DEFAULT_COLLECTOR_PERSIST_INTERVAL); |
52 |
0 |
return Long.parseLong(interval); |
53 |
|
} |
54 |
|
|
55 |
|
public static int getColorThreshold(){ |
56 |
0 |
String threshold = propertyUtil.getProperty(WEB_COLOR_THRESHOLD, |
57 |
|
DEFAULT_WEB_COLOR_THRESHOLD); |
58 |
0 |
return Integer.parseInt(threshold); |
59 |
|
} |
60 |
|
|
61 |
|
public static int getNumOfSqlQueries(){ |
62 |
0 |
String sqlQueries = propertyUtil.getProperty(WEB_NUM_OF_SQL_QUERIES, |
63 |
|
DEFAULT_NUM_OF_SQL_QUERIES); |
64 |
0 |
return Integer.parseInt(sqlQueries); |
65 |
|
} |
66 |
|
} |