1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package net.admin4j.config; |
15 | |
|
16 | |
import java.io.File; |
17 | |
import java.util.HashSet; |
18 | |
import java.util.Set; |
19 | |
|
20 | |
import net.admin4j.ui.filters.consolidator.HttpRequestConsolidator; |
21 | |
import net.admin4j.util.notify.Notifier; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 96 | public class Admin4JConfiguration { |
30 | |
|
31 | 36 | public enum StorageFormat { |
32 | 12 | XML, DATABASE |
33 | 96 | }; |
34 | |
|
35 | 99 | private static StorageFormat exceptionInformationStorageFormat = null; |
36 | 99 | private static String exceptionInformationXmlFileName = null; |
37 | 99 | private static StorageFormat performanceInformationStorageFormat = null; |
38 | 99 | private static String performanceInformationXmlFileName = null; |
39 | 99 | private static HttpRequestConsolidator performanceRestUriConsolidator = null; |
40 | 99 | private static Notifier defaultNotifier = null; |
41 | |
|
42 | 99 | private static File baseFreemarkerTemplateDirectory = null; |
43 | |
|
44 | 99 | private static Set<String> additionalLogManagerClassNames = new HashSet<String>(); |
45 | |
|
46 | 99 | private static Integer exceptionTimeTrackingInDays = null; |
47 | 99 | private static String exceptionExemptedExceptionTypes = null; |
48 | |
|
49 | 99 | private static Boolean fileExplorerRestrictToBaseDir = null; |
50 | 99 | private static Boolean fileExplorerRestrictFromExec = null; |
51 | 99 | private static Boolean fileExplorerRestrictFromWrite = null; |
52 | 99 | private static String fileExplorerBaseDirName = null; |
53 | |
|
54 | 99 | private static Integer hotSpotSleepIntervalMillis = null; |
55 | 99 | private static Integer memoryThresholdPct = null; |
56 | 99 | private static Integer memoryNbrIntervalsBetweenWarnings = null; |
57 | 99 | private static Long memorySleepIntervalMillis = null; |
58 | 99 | private static Integer memoryNbrLowWatermarkIntervals = null; |
59 | 99 | private static Long memoryLowWatermarkMonitorIntervalInMillis = null; |
60 | |
|
61 | 99 | private static Integer sqlNbrRetainedSqlStatements = null; |
62 | 99 | private static Long sqlRetentionTimeInMillis = null; |
63 | |
|
64 | 99 | private static Integer threadSleepIntervalMillis = null; |
65 | 99 | private static Integer threadMaxBlockedThreads = null; |
66 | |
|
67 | 99 | private static Integer concurrentUsageSleepIntervalMillis = null; |
68 | 99 | private static Integer[] concurrentUsageAlertLevels = null; |
69 | |
|
70 | 99 | private static String webTransactionErrorLoggerName = null; |
71 | 99 | private static Long errorNotificationTimeIntervalMillis = null; |
72 | 99 | private static String errorExemptedExceptionTypes = null; |
73 | 99 | private static Long webTransactionPerformanceNotificationThresholdInMillis = null; |
74 | |
|
75 | 99 | private static Integer requestHistoryNbrRetained = null; |
76 | |
|
77 | |
|
78 | |
static { |
79 | 99 | PropertyConfigurator.configure(); |
80 | 99 | } |
81 | |
|
82 | |
public static Set<String> getAdditionalLogManagerClassNames() { |
83 | 18 | return additionalLogManagerClassNames; |
84 | |
} |
85 | |
|
86 | |
public static File getBaseFreemarkerTemplateDirectory() { |
87 | 261 | return baseFreemarkerTemplateDirectory; |
88 | |
} |
89 | |
|
90 | |
public static Integer[] getConcurrentUsageAlertLevels() { |
91 | 6 | return concurrentUsageAlertLevels; |
92 | |
} |
93 | |
|
94 | |
public static Integer getConcurrentUsageSleepIntervalMillis() { |
95 | 6 | return concurrentUsageSleepIntervalMillis; |
96 | |
} |
97 | |
|
98 | |
public static Notifier getDefaultNotifier() { |
99 | 9 | return defaultNotifier; |
100 | |
} |
101 | |
|
102 | |
public static String getErrorExemptedExceptionTypes() { |
103 | 12 | return errorExemptedExceptionTypes; |
104 | |
} |
105 | |
|
106 | |
public static Long getErrorNotificationTimeIntervalMillis() { |
107 | 12 | return errorNotificationTimeIntervalMillis; |
108 | |
} |
109 | |
|
110 | |
public static String getExceptionExemptedExceptionTypes() { |
111 | 9 | return exceptionExemptedExceptionTypes; |
112 | |
} |
113 | |
|
114 | |
public static StorageFormat getExceptionInformationStorageFormat() { |
115 | 12 | return exceptionInformationStorageFormat; |
116 | |
} |
117 | |
|
118 | |
public static String getExceptionInformationXmlFileName() { |
119 | 18 | return exceptionInformationXmlFileName; |
120 | |
} |
121 | |
|
122 | |
public static Integer getExceptionTimeTrackingInDays() { |
123 | 6 | return exceptionTimeTrackingInDays; |
124 | |
} |
125 | |
|
126 | |
public static String getFileExplorerBaseDirName() { |
127 | 9 | return fileExplorerBaseDirName; |
128 | |
} |
129 | |
|
130 | |
public static Boolean getFileExplorerRestrictFromExec() { |
131 | 9 | return fileExplorerRestrictFromExec; |
132 | |
} |
133 | |
|
134 | |
public static Boolean getFileExplorerRestrictFromWrite() { |
135 | 9 | return fileExplorerRestrictFromWrite; |
136 | |
} |
137 | |
|
138 | |
public static Boolean getFileExplorerRestrictToBaseDir() { |
139 | 9 | return fileExplorerRestrictToBaseDir; |
140 | |
} |
141 | |
|
142 | |
public static Integer getHotSpotSleepIntervalMillis() { |
143 | 6 | return hotSpotSleepIntervalMillis; |
144 | |
} |
145 | |
|
146 | |
public static Long getMemoryLowWatermarkMonitorIntervalInMillis() { |
147 | 6 | return memoryLowWatermarkMonitorIntervalInMillis; |
148 | |
} |
149 | |
|
150 | |
public static Integer getMemoryNbrIntervalsBetweenWarnings() { |
151 | 6 | return memoryNbrIntervalsBetweenWarnings; |
152 | |
} |
153 | |
|
154 | |
public static Integer getMemoryNbrLowWatermarkIntervals() { |
155 | 6 | return memoryNbrLowWatermarkIntervals; |
156 | |
} |
157 | |
|
158 | |
public static Long getMemorySleepIntervalMillis() { |
159 | 6 | return memorySleepIntervalMillis; |
160 | |
} |
161 | |
|
162 | |
public static Integer getMemoryThresholdPct() { |
163 | 6 | return memoryThresholdPct; |
164 | |
} |
165 | |
|
166 | |
public static StorageFormat getPerformanceInformationStorageFormat() { |
167 | 15 | return performanceInformationStorageFormat; |
168 | |
} |
169 | |
|
170 | |
public static String getPerformanceInformationXmlFileName() { |
171 | 18 | return performanceInformationXmlFileName; |
172 | |
} |
173 | |
|
174 | |
public static HttpRequestConsolidator getPerformanceRestUriConsolidator() { |
175 | 9 | return performanceRestUriConsolidator; |
176 | |
} |
177 | |
|
178 | |
public static Integer getRequestHistoryNbrRetained() { |
179 | 9 | return requestHistoryNbrRetained; |
180 | |
} |
181 | |
|
182 | |
public static Integer getSqlNbrRetainedSqlStatements() { |
183 | 15 | return sqlNbrRetainedSqlStatements; |
184 | |
} |
185 | |
|
186 | |
public static Long getSqlRetentionTimeInMillis() { |
187 | 15 | return sqlRetentionTimeInMillis; |
188 | |
} |
189 | |
|
190 | |
public static Integer getThreadMaxBlockedThreads() { |
191 | 6 | return threadMaxBlockedThreads; |
192 | |
} |
193 | |
|
194 | |
public static Integer getThreadSleepIntervalMillis() { |
195 | 6 | return threadSleepIntervalMillis; |
196 | |
} |
197 | |
|
198 | |
public static String getWebTransactionErrorLoggerName() { |
199 | 21 | return webTransactionErrorLoggerName; |
200 | |
} |
201 | |
|
202 | |
public static Long getWebTransactionPerformanceNotificationThresholdInMillis() { |
203 | 9 | return webTransactionPerformanceNotificationThresholdInMillis; |
204 | |
} |
205 | |
|
206 | |
public static boolean isExceptionInfoStored() { |
207 | 30 | return exceptionInformationXmlFileName != null; |
208 | |
} |
209 | |
|
210 | |
public static boolean isPerformanceInfoStored() { |
211 | 54 | return performanceInformationXmlFileName != null; |
212 | |
} |
213 | |
|
214 | |
static void setBaseFreemarkerTemplateDirectory( |
215 | |
File baseFreemarkerTemplateDirectory) { |
216 | 9 | Admin4JConfiguration.baseFreemarkerTemplateDirectory = baseFreemarkerTemplateDirectory; |
217 | 9 | } |
218 | |
|
219 | |
public static void setConcurrentUsageAlertLevels( |
220 | |
Integer[] concurrentUsageAlertLevels) { |
221 | 9 | Admin4JConfiguration.concurrentUsageAlertLevels = concurrentUsageAlertLevels; |
222 | 9 | } |
223 | |
|
224 | |
public static void setConcurrentUsageSleepIntervalMillis( |
225 | |
Integer concurrentUsageSleepIntervalMillis) { |
226 | 9 | Admin4JConfiguration.concurrentUsageSleepIntervalMillis = concurrentUsageSleepIntervalMillis; |
227 | 9 | } |
228 | |
|
229 | |
static void setDefaultNotifier(Notifier defaultNotifier) { |
230 | 9 | Admin4JConfiguration.defaultNotifier = defaultNotifier; |
231 | 9 | } |
232 | |
|
233 | |
static void setErrorExemptedExceptionTypes( |
234 | |
String errorExemptedExceptionTypes) { |
235 | 9 | Admin4JConfiguration.errorExemptedExceptionTypes = errorExemptedExceptionTypes; |
236 | 9 | } |
237 | |
|
238 | |
static void setErrorNotificationTimeIntervalMillis( |
239 | |
Long errorNotificationTimeIntervalMillis) { |
240 | 9 | Admin4JConfiguration.errorNotificationTimeIntervalMillis = errorNotificationTimeIntervalMillis; |
241 | 9 | } |
242 | |
|
243 | |
static void setExceptionExemptedExceptionTypes( |
244 | |
String exceptionExemptedExceptionTypes) { |
245 | 9 | Admin4JConfiguration.exceptionExemptedExceptionTypes = exceptionExemptedExceptionTypes; |
246 | 9 | } |
247 | |
|
248 | |
public static void setExceptionInformationStorageFormat( |
249 | |
StorageFormat exceptionInformationStorageFormat) { |
250 | 24 | Admin4JConfiguration.exceptionInformationStorageFormat = exceptionInformationStorageFormat; |
251 | 24 | } |
252 | |
|
253 | |
static void setExceptionInformationXmlFileName( |
254 | |
String exceptionInformationXmlFileName) { |
255 | 33 | Admin4JConfiguration.exceptionInformationXmlFileName = exceptionInformationXmlFileName; |
256 | 33 | } |
257 | |
|
258 | |
static void setExceptionTimeTrackingInDays( |
259 | |
Integer exceptionTimeTrackingInDays) { |
260 | 9 | Admin4JConfiguration.exceptionTimeTrackingInDays = exceptionTimeTrackingInDays; |
261 | 9 | } |
262 | |
|
263 | |
static void setFileExplorerBaseDirName(String fileBrowserBaseDirName) { |
264 | 9 | Admin4JConfiguration.fileExplorerBaseDirName = fileBrowserBaseDirName; |
265 | 9 | } |
266 | |
|
267 | |
static void setFileExplorerRestrictFromExec( |
268 | |
Boolean fileBrowserRestrictFromExec) { |
269 | 9 | Admin4JConfiguration.fileExplorerRestrictFromExec = fileBrowserRestrictFromExec; |
270 | 9 | } |
271 | |
|
272 | |
static void setFileExplorerRestrictFromWrite( |
273 | |
Boolean fileBrowserRestrictFromWrite) { |
274 | 9 | Admin4JConfiguration.fileExplorerRestrictFromWrite = fileBrowserRestrictFromWrite; |
275 | 9 | } |
276 | |
|
277 | |
static void setFileExplorerRestrictToBaseDir( |
278 | |
Boolean fileBrowserRestrictToBaseDir) { |
279 | 9 | Admin4JConfiguration.fileExplorerRestrictToBaseDir = fileBrowserRestrictToBaseDir; |
280 | 9 | } |
281 | |
|
282 | |
static void setHotSpotSleepIntervalMillis(Integer hotSpotSleepIntervalMillis) { |
283 | 9 | Admin4JConfiguration.hotSpotSleepIntervalMillis = hotSpotSleepIntervalMillis; |
284 | 9 | } |
285 | |
|
286 | |
public static void setMemoryLowWatermarkMonitorIntervalInMillis( |
287 | |
Long memoryLowWatermarkMonitorIntervalInMillis) { |
288 | 9 | Admin4JConfiguration.memoryLowWatermarkMonitorIntervalInMillis = memoryLowWatermarkMonitorIntervalInMillis; |
289 | 9 | } |
290 | |
|
291 | |
static void setMemoryNbrIntervalsBetweenWarnings( |
292 | |
Integer memoryNbrIntervalsBetweenWarnings) { |
293 | 9 | Admin4JConfiguration.memoryNbrIntervalsBetweenWarnings = memoryNbrIntervalsBetweenWarnings; |
294 | 9 | } |
295 | |
|
296 | |
public static void setMemoryNbrLowWatermarkIntervals( |
297 | |
Integer memoryNbrLowWatermarkIntervals) { |
298 | 9 | Admin4JConfiguration.memoryNbrLowWatermarkIntervals = memoryNbrLowWatermarkIntervals; |
299 | 9 | } |
300 | |
|
301 | |
static void setMemorySleepIntervalMillis(Long memorySleepIntervalMillis) { |
302 | 9 | Admin4JConfiguration.memorySleepIntervalMillis = memorySleepIntervalMillis; |
303 | 9 | } |
304 | |
|
305 | |
static void setMemoryThresholdPct(Integer memoryThresholdPct) { |
306 | 9 | Admin4JConfiguration.memoryThresholdPct = memoryThresholdPct; |
307 | 9 | } |
308 | |
|
309 | |
public static void setPerformanceInformationStorageFormat( |
310 | |
StorageFormat performanceInformationStorageFormat) { |
311 | 21 | Admin4JConfiguration.performanceInformationStorageFormat = performanceInformationStorageFormat; |
312 | 21 | } |
313 | |
|
314 | |
static void setPerformanceInformationXmlFileName( |
315 | |
String performanceInformationXmlFileName) { |
316 | 24 | Admin4JConfiguration.performanceInformationXmlFileName = performanceInformationXmlFileName; |
317 | 24 | } |
318 | |
|
319 | |
static void setPerformanceRestUriConsolidator( |
320 | |
HttpRequestConsolidator performanceRestUriConsolidator) { |
321 | 0 | Admin4JConfiguration.performanceRestUriConsolidator = performanceRestUriConsolidator; |
322 | 0 | } |
323 | |
|
324 | |
public static void setRequestHistoryNbrRetained( |
325 | |
Integer requestHistoryNbrRetained) { |
326 | 3 | Admin4JConfiguration.requestHistoryNbrRetained = requestHistoryNbrRetained; |
327 | 3 | } |
328 | |
|
329 | |
public static void setSqlNbrRetainedSqlStatements( |
330 | |
Integer sqlTimerNbrSqlStatements) { |
331 | 9 | Admin4JConfiguration.sqlNbrRetainedSqlStatements = sqlTimerNbrSqlStatements; |
332 | 9 | } |
333 | |
|
334 | |
public static void setSqlRetentionTimeInMillis(Long sqlRetentionTimeInMillis) { |
335 | 9 | Admin4JConfiguration.sqlRetentionTimeInMillis = sqlRetentionTimeInMillis; |
336 | 9 | } |
337 | |
|
338 | |
static void setThreadMaxBlockedThreads(Integer threadMaxBlockedThreads) { |
339 | 9 | Admin4JConfiguration.threadMaxBlockedThreads = threadMaxBlockedThreads; |
340 | 9 | } |
341 | |
|
342 | |
static void setThreadSleepIntervalMillis(Integer threadSleepIntervalMillis) { |
343 | 9 | Admin4JConfiguration.threadSleepIntervalMillis = threadSleepIntervalMillis; |
344 | 9 | } |
345 | |
|
346 | |
static void setWebTransactionErrorLoggerName(String errorLoggerName) { |
347 | 9 | Admin4JConfiguration.webTransactionErrorLoggerName = errorLoggerName; |
348 | 9 | } |
349 | |
|
350 | |
static void setWebTransactionPerformanceNotificationThresholdInMillis( |
351 | |
Long webTransactionPerformanceNotificationThresholdInMillis) { |
352 | 9 | Admin4JConfiguration.webTransactionPerformanceNotificationThresholdInMillis = webTransactionPerformanceNotificationThresholdInMillis; |
353 | 9 | } |
354 | |
|
355 | |
} |