|
1 |
| package com.sourceforge.jpatterns.core.configuration; |
|
2 |
| |
|
3 |
| import com.sourceforge.jpatterns.core.JPConstants; |
|
4 |
| import com.sourceforge.jpatterns.core.configuration.exceptions.JPInitializationException; |
|
5 |
| import com.sourceforge.jpatterns.core.configuration.model.IJPatternsConfigBeansBuilder; |
|
6 |
| import com.sourceforge.jpatterns.core.configuration.model.JPatternsConfigBaseBean; |
|
7 |
| import com.sourceforge.jpatterns.core.configuration.model.JPatternsConfigBean; |
|
8 |
| import com.sourceforge.jpatterns.core.configuration.model.JPatternsConfigsBean; |
|
9 |
| import com.sourceforge.jpatterns.schema.JPatternsConfig; |
|
10 |
| import com.sourceforge.jpatterns.utils.CastorUtils; |
|
11 |
| import com.zmicer.utils.ClassPathUtils; |
|
12 |
| import com.zmicer.utils.FileUtils; |
|
13 |
| import com.zmicer.utils.InputArgumentUtils; |
|
14 |
| import com.zmicer.utils.ResourceUtils; |
|
15 |
| import org.apache.log4j.Logger; |
|
16 |
| |
|
17 |
| import java.io.File; |
|
18 |
| import java.net.URL; |
|
19 |
| import java.util.ArrayList; |
|
20 |
| import java.util.List; |
|
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 |
| public class JPConfiguratorImpl implements IJPConfigurator |
|
53 |
| { |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| final public static Logger LOG = Logger.getLogger(JPConfiguratorImpl.class); |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| private JPatternsConfigBean m_defaultFrameworkConfig = null; |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| private JPatternsConfigBean m_customFrameworkConfig = null; |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| private JPatternsConfigsBean m_mergedFrameworkConfig = null; |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| private JPatternsConfigsBean m_mergedDefaultConsumerConfig = null; |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| private JPatternsConfigsBean m_mergedCustomConsumerConfig = null; |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| private JPatternsConfigsBean m_mergedConsumerConfig = null; |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| private List<File> m_consumerConfigurationFiles = new ArrayList<File>(); |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| private List<File> m_consumerConfigurationCustomFiles = new ArrayList<File>(); |
|
108 |
| |
|
109 |
| |
|
110 |
| |
|
111 |
| |
|
112 |
| private static Boolean useOnlyCustomFrameworkConfigIfPresent = null; |
|
113 |
| |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| private static Boolean useOnlyCustomConsumerConfigIfPresent = null; |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
| |
|
122 |
| |
|
123 |
| |
|
124 |
| |
|
125 |
| |
|
126 |
| |
|
127 |
30
| public JPConfiguratorImpl()
|
|
128 |
| { |
|
129 |
30
| super();
|
|
130 |
30
| initConfiguration();
|
|
131 |
| } |
|
132 |
| |
|
133 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
| |
|
138 |
33
| protected void initConfiguration()
|
|
139 |
| { |
|
140 |
| |
|
141 |
33
| final IPropertiesManager manager = PropertiesBasedFactory.getInstance().getPropertiesManager();
|
|
142 |
33
| final PropertiesProvider propsProvider = PropertiesProvider.getInstance(manager, false);
|
|
143 |
33
| useOnlyCustomFrameworkConfigIfPresent =
|
|
144 |
| propsProvider.getBooleanProperty(PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_XML); |
|
145 |
33
| useOnlyCustomConsumerConfigIfPresent =
|
|
146 |
| propsProvider.getBooleanProperty(PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_CONSUMER_XML); |
|
147 |
| |
|
148 |
33
| initFrameworkConfiguration();
|
|
149 |
33
| initConsumerConfiguration();
|
|
150 |
| } |
|
151 |
| |
|
152 |
| |
|
153 |
| |
|
154 |
| |
|
155 |
38
| protected void initFrameworkConfiguration()
|
|
156 |
| { |
|
157 |
38
| m_defaultFrameworkConfig = obtainJPatternsConfig(getJPatternsFrameworkConfigurationFileName());
|
|
158 |
38
| m_customFrameworkConfig = obtainJPatternsConfig(getJPatternsFrameworkCustomConfigurationFileName());
|
|
159 |
38
| mergeFrameworkConfigurations();
|
|
160 |
| } |
|
161 |
| |
|
162 |
| |
|
163 |
| |
|
164 |
| |
|
165 |
| |
|
166 |
| |
|
167 |
| |
|
168 |
| |
|
169 |
| |
|
170 |
| |
|
171 |
| |
|
172 |
| |
|
173 |
| |
|
174 |
| |
|
175 |
| |
|
176 |
| |
|
177 |
38
| protected void mergeFrameworkConfigurations()
|
|
178 |
| { |
|
179 |
38
| final IJPatternsConfigBeansBuilder builder = PropertiesBasedFactory.getInstance().getJPatternsConfigBaseBeanBuilder();
|
|
180 |
| |
|
181 |
38
| if (!defaultJPatternsFrameworkConfigurationPresents())
|
|
182 |
| { |
|
183 |
1
| throw new IllegalStateException("The default framework configuration should be present.");
|
|
184 |
| } |
|
185 |
37
| if (!customJPatternsFrameworkConfigurationPresents())
|
|
186 |
| { |
|
187 |
20
| if (defaultJPatternsFrameworkConfigurationPresents())
|
|
188 |
| { |
|
189 |
20
| final List<JPatternsConfigBaseBean> beans = new ArrayList<JPatternsConfigBaseBean>();
|
|
190 |
20
| beans.add(m_defaultFrameworkConfig);
|
|
191 |
20
| m_mergedFrameworkConfig = builder.build(beans);
|
|
192 |
20
| return;
|
|
193 |
| } |
|
194 |
| else |
|
195 |
| { |
|
196 |
| |
|
197 |
0
| throw new IllegalStateException("The default framework configuration should be present.");
|
|
198 |
| } |
|
199 |
| } |
|
200 |
| |
|
201 |
17
| if (customJPatternsFrameworkConfigurationPresents() && defaultJPatternsFrameworkConfigurationPresents() &&
|
|
202 |
| null != useOnlyCustomFrameworkConfigIfPresent && useOnlyCustomFrameworkConfigIfPresent) |
|
203 |
| { |
|
204 |
1
| final List<JPatternsConfigBaseBean> beans = new ArrayList<JPatternsConfigBaseBean>();
|
|
205 |
1
| beans.add(m_customFrameworkConfig);
|
|
206 |
1
| m_mergedFrameworkConfig = builder.build(beans);
|
|
207 |
1
| return;
|
|
208 |
| } |
|
209 |
| |
|
210 |
16
| if ((null != useOnlyCustomFrameworkConfigIfPresent && !useOnlyCustomFrameworkConfigIfPresent) ||
|
|
211 |
| null == useOnlyCustomFrameworkConfigIfPresent) |
|
212 |
| { |
|
213 |
| |
|
214 |
16
| CastorUtils.makePrioritized(m_customFrameworkConfig.getCastorConfig());
|
|
215 |
16
| final List<JPatternsConfigBaseBean> beans = new ArrayList<JPatternsConfigBaseBean>();
|
|
216 |
16
| beans.add(m_customFrameworkConfig);
|
|
217 |
16
| beans.add(m_defaultFrameworkConfig);
|
|
218 |
16
| m_mergedFrameworkConfig = builder.build(beans);
|
|
219 |
| } |
|
220 |
| } |
|
221 |
| |
|
222 |
| |
|
223 |
| |
|
224 |
| |
|
225 |
| |
|
226 |
| |
|
227 |
| |
|
228 |
| |
|
229 |
36
| protected void initConsumerConfiguration()
|
|
230 |
| { |
|
231 |
36
| final IJPatternsConfigBeansBuilder builder = PropertiesBasedFactory.getInstance().getJPatternsConfigBaseBeanBuilder();
|
|
232 |
| |
|
233 |
| |
|
234 |
36
| final String defaultConsumerDir = getJPatternsConsumerConfigurationDirName();
|
|
235 |
36
| List<String> classPathesStrings = null;
|
|
236 |
36
| if (null != defaultConsumerDir && defaultConsumerDir.length() != 0)
|
|
237 |
| { |
|
238 |
36
| classPathesStrings = ClassPathUtils.getClassPathes(defaultConsumerDir);
|
|
239 |
| } |
|
240 |
| else |
|
241 |
| { |
|
242 |
0
| classPathesStrings = ClassPathUtils.getClassPathes();
|
|
243 |
| } |
|
244 |
| |
|
245 |
36
| if (null == classPathesStrings || classPathesStrings.isEmpty())
|
|
246 |
| { |
|
247 |
0
| throw new IllegalStateException("The class path is not set correctly.");
|
|
248 |
| } |
|
249 |
36
| m_consumerConfigurationFiles = FileUtils.findFilesByREInClassPath(classPathesStrings, JPConstants.PATTERN);
|
|
250 |
| |
|
251 |
| |
|
252 |
36
| final String consumerCustomDir = getJPatternsConsumerCustomConfigurationDirName();
|
|
253 |
36
| if (null == consumerCustomDir)
|
|
254 |
| { |
|
255 |
0
| LOG.debug("The consumer custom configuration is not provided. The appropriate JPatternsConfig object are not initialized.");
|
|
256 |
| } |
|
257 |
| else |
|
258 |
| { |
|
259 |
36
| final List<String> customClassPathesStrings = ClassPathUtils.getClassPathes(consumerCustomDir);
|
|
260 |
36
| if (null == customClassPathesStrings || customClassPathesStrings.isEmpty())
|
|
261 |
| { |
|
262 |
| |
|
263 |
0
| return;
|
|
264 |
| } |
|
265 |
36
| m_consumerConfigurationCustomFiles = FileUtils.findFilesByREInClassPath(customClassPathesStrings, JPConstants.PATTERN);
|
|
266 |
| } |
|
267 |
| |
|
268 |
| |
|
269 |
36
| if (null != m_consumerConfigurationFiles)
|
|
270 |
| { |
|
271 |
36
| final List<JPatternsConfig> configs = obtainJPatternsConfigs(m_consumerConfigurationFiles);
|
|
272 |
36
| final List<JPatternsConfigBaseBean> defaultConsumerConfigs = new ArrayList<JPatternsConfigBaseBean>();
|
|
273 |
36
| for (JPatternsConfig config : configs)
|
|
274 |
| { |
|
275 |
42
| defaultConsumerConfigs.add(builder.build(config));
|
|
276 |
| } |
|
277 |
36
| m_mergedDefaultConsumerConfig = builder.build(defaultConsumerConfigs);
|
|
278 |
| } |
|
279 |
| |
|
280 |
| |
|
281 |
36
| if (null != m_consumerConfigurationCustomFiles)
|
|
282 |
| { |
|
283 |
36
| final List<JPatternsConfig> customConfigs = obtainJPatternsConfigs(m_consumerConfigurationCustomFiles);
|
|
284 |
| |
|
285 |
36
| final List<JPatternsConfigBaseBean> customConsumerConfigs = new ArrayList<JPatternsConfigBaseBean>();
|
|
286 |
36
| for (JPatternsConfig config : customConfigs)
|
|
287 |
| { |
|
288 |
0
| customConsumerConfigs.add(builder.build(config));
|
|
289 |
| } |
|
290 |
36
| m_mergedCustomConsumerConfig = builder.build(customConsumerConfigs);
|
|
291 |
| } |
|
292 |
| |
|
293 |
36
| if (null == m_mergedDefaultConsumerConfig && null == m_mergedCustomConsumerConfig)
|
|
294 |
| { |
|
295 |
0
| throw new JPInitializationException("There is not consumer configuration provided. It is incorrect state for the JPatterns.");
|
|
296 |
| } |
|
297 |
| |
|
298 |
| |
|
299 |
36
| mergeConsumerConfigurations();
|
|
300 |
| } |
|
301 |
| |
|
302 |
| |
|
303 |
| |
|
304 |
| |
|
305 |
| |
|
306 |
| |
|
307 |
| |
|
308 |
| |
|
309 |
| |
|
310 |
| |
|
311 |
| |
|
312 |
| |
|
313 |
| |
|
314 |
| |
|
315 |
| |
|
316 |
| |
|
317 |
36
| protected void mergeConsumerConfigurations()
|
|
318 |
| { |
|
319 |
| |
|
320 |
36
| if (!customJPatternsConsumerConfigurationPresents())
|
|
321 |
| { |
|
322 |
36
| if (defaultJPatternsConsumerConfigurationPresents())
|
|
323 |
| { |
|
324 |
35
| m_mergedConsumerConfig = m_mergedDefaultConsumerConfig;
|
|
325 |
| } |
|
326 |
| else |
|
327 |
| { |
|
328 |
| |
|
329 |
1
| throw new IllegalStateException("The default consumer configuration should be present.");
|
|
330 |
| } |
|
331 |
| } |
|
332 |
| |
|
333 |
35
| if (customJPatternsConsumerConfigurationPresents() && defaultJPatternsConsumerConfigurationPresents() &&
|
|
334 |
| null != useOnlyCustomConsumerConfigIfPresent && useOnlyCustomConsumerConfigIfPresent) |
|
335 |
| { |
|
336 |
0
| m_mergedConsumerConfig = m_mergedCustomConsumerConfig;
|
|
337 |
| } |
|
338 |
| |
|
339 |
35
| if ((null != useOnlyCustomConsumerConfigIfPresent && !useOnlyCustomConsumerConfigIfPresent) ||
|
|
340 |
| null == useOnlyCustomConsumerConfigIfPresent) |
|
341 |
| { |
|
342 |
| |
|
343 |
35
| CastorUtils.makePrioritized(m_mergedCustomConsumerConfig);
|
|
344 |
35
| final List<JPatternsConfigBaseBean> beans = new ArrayList<JPatternsConfigBaseBean>();
|
|
345 |
35
| beans.add(m_mergedCustomConsumerConfig);
|
|
346 |
35
| beans.add(m_mergedDefaultConsumerConfig);
|
|
347 |
35
| final IJPatternsConfigBeansBuilder builder = PropertiesBasedFactory.getInstance().getJPatternsConfigBaseBeanBuilder();
|
|
348 |
35
| m_mergedConsumerConfig = builder.build(beans);
|
|
349 |
| } |
|
350 |
| } |
|
351 |
| |
|
352 |
| |
|
353 |
| |
|
354 |
| |
|
355 |
| |
|
356 |
| |
|
357 |
| |
|
358 |
74
| protected List<JPatternsConfig> obtainJPatternsConfigs(final List<File> files)
|
|
359 |
| { |
|
360 |
74
| if (null == files)
|
|
361 |
| { |
|
362 |
1
| throw new IllegalArgumentException("The List of File objects can not be null.");
|
|
363 |
| } |
|
364 |
73
| final List<JPatternsConfig> result = new ArrayList<JPatternsConfig>();
|
|
365 |
73
| for (final File file : files)
|
|
366 |
| { |
|
367 |
74
| final JPatternsConfig config = CastorUtils.getJPatternsConfig(file);
|
|
368 |
74
| if (null != config)
|
|
369 |
| { |
|
370 |
74
| result.add(config);
|
|
371 |
| } |
|
372 |
| } |
|
373 |
73
| return result;
|
|
374 |
| } |
|
375 |
| |
|
376 |
| |
|
377 |
| |
|
378 |
| |
|
379 |
| |
|
380 |
| |
|
381 |
| |
|
382 |
| |
|
383 |
| |
|
384 |
| |
|
385 |
| |
|
386 |
| |
|
387 |
| |
|
388 |
| |
|
389 |
79
| protected JPatternsConfigBean obtainJPatternsConfig(final String name)
|
|
390 |
| { |
|
391 |
79
| InputArgumentUtils.checkStrings(true, name);
|
|
392 |
78
| JPatternsConfig result = null;
|
|
393 |
78
| final IJPatternsConfigBeansBuilder builder = PropertiesBasedFactory.getInstance().getJPatternsConfigBaseBeanBuilder();
|
|
394 |
| |
|
395 |
78
| final URL url = ResourceUtils.getResource(name);
|
|
396 |
78
| if (url != null)
|
|
397 |
| { |
|
398 |
56
| final File file = new File(url.getFile());
|
|
399 |
56
| result = CastorUtils.getJPatternsConfig(file);
|
|
400 |
56
| if (null != result)
|
|
401 |
| { |
|
402 |
56
| LOG.debug("The JPatterns configuration was obtained using the classloaders (ResourceUtils.getResource) for the name " +
|
|
403 |
| name); |
|
404 |
56
| if (null == builder)
|
|
405 |
| { |
|
406 |
0
| throw new IllegalStateException("The IJPatternsConfigBeansBuilder instance can not be null.");
|
|
407 |
| } |
|
408 |
56
| return builder.build(result);
|
|
409 |
| } |
|
410 |
| } |
|
411 |
| |
|
412 |
22
| final File file = new File(name);
|
|
413 |
22
| if (file.isFile())
|
|
414 |
| { |
|
415 |
| |
|
416 |
0
| result = CastorUtils.getJPatternsConfig(file);
|
|
417 |
0
| if (null != result)
|
|
418 |
| { |
|
419 |
0
| LOG.debug("The JPatterns configuration was obtained using the File for the name " +
|
|
420 |
| name); |
|
421 |
0
| return builder.build(result);
|
|
422 |
| } |
|
423 |
| } |
|
424 |
22
| return null;
|
|
425 |
| } |
|
426 |
| |
|
427 |
| |
|
428 |
| |
|
429 |
| |
|
430 |
| |
|
431 |
| |
|
432 |
| |
|
433 |
| |
|
434 |
| |
|
435 |
| |
|
436 |
| |
|
437 |
| |
|
438 |
41
| public String getJPatternsFrameworkConfigurationFileName()
|
|
439 |
| { |
|
440 |
41
| final String jvmDefault = System.getProperty(JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM);
|
|
441 |
41
| if (null != jvmDefault && !"".equals(jvmDefault.trim()))
|
|
442 |
| { |
|
443 |
39
| LOG.debug("Please be noticed the JVM param based value for the default XML is used. This value is : " + jvmDefault);
|
|
444 |
39
| return jvmDefault;
|
|
445 |
| } |
|
446 |
2
| final IPropertiesManager propsManager = PropertiesBasedFactory.getInstance().getPropertiesManager();
|
|
447 |
2
| if (null == propsManager)
|
|
448 |
| { |
|
449 |
0
| throw new IllegalStateException("Smth. wrong with the core initialization. Properties manager can not be null.");
|
|
450 |
| } |
|
451 |
2
| final String propsValue =
|
|
452 |
| propsManager.getBundle(JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME_PROPS_PARAM); |
|
453 |
2
| if (null != propsValue && !"".equals(propsValue.trim()))
|
|
454 |
| { |
|
455 |
1
| LOG.debug("The properties defined value is used for the JPatterns framework default configuration.");
|
|
456 |
1
| return propsValue;
|
|
457 |
| } |
|
458 |
1
| LOG.debug("The default not JVM based value is used : " +
|
|
459 |
| JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME); |
|
460 |
1
| return JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME;
|
|
461 |
| } |
|
462 |
| |
|
463 |
| |
|
464 |
| |
|
465 |
| |
|
466 |
| |
|
467 |
| |
|
468 |
41
| public String getJPatternsFrameworkCustomConfigurationFileName()
|
|
469 |
| { |
|
470 |
41
| final String jvmDefault = System.getProperty(JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM);
|
|
471 |
41
| if (null != jvmDefault && !"".equals(jvmDefault.trim()))
|
|
472 |
| { |
|
473 |
39
| LOG.debug("Please be noticed the JVM param based value for the default custom XML is used. This value is : " + jvmDefault);
|
|
474 |
39
| return jvmDefault;
|
|
475 |
| } |
|
476 |
2
| final IPropertiesManager propsManager = PropertiesBasedFactory.getInstance().getPropertiesManager();
|
|
477 |
2
| if (null == propsManager)
|
|
478 |
| { |
|
479 |
0
| throw new IllegalStateException("Smth. wrong with the core initialization. Properties manager can not be null.");
|
|
480 |
| } |
|
481 |
2
| final String propsValue =
|
|
482 |
| propsManager.getBundle(JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_PROPS_PARAM); |
|
483 |
2
| if (null != propsValue && !"".equals(propsValue.trim()))
|
|
484 |
| { |
|
485 |
1
| LOG.debug("The properties defined value is used for the JPatterns framework custom configuration.");
|
|
486 |
1
| return propsValue;
|
|
487 |
| } |
|
488 |
1
| LOG.debug("The default custom not JVM based value is used : " +
|
|
489 |
| JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME); |
|
490 |
1
| return JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME;
|
|
491 |
| } |
|
492 |
| |
|
493 |
| |
|
494 |
| |
|
495 |
| |
|
496 |
2
| public List<File> getJPatternsConsumerConfigurationFiles()
|
|
497 |
| { |
|
498 |
2
| return m_consumerConfigurationFiles;
|
|
499 |
| } |
|
500 |
| |
|
501 |
| |
|
502 |
| |
|
503 |
| |
|
504 |
0
| public List<File> getJPatternsConsumerCustomConfigurationFiles()
|
|
505 |
| { |
|
506 |
0
| return m_consumerConfigurationCustomFiles;
|
|
507 |
| } |
|
508 |
| |
|
509 |
| |
|
510 |
| |
|
511 |
| |
|
512 |
| |
|
513 |
| |
|
514 |
| |
|
515 |
| |
|
516 |
| |
|
517 |
| |
|
518 |
| |
|
519 |
| |
|
520 |
36
| public String getJPatternsConsumerCustomConfigurationDirName()
|
|
521 |
| { |
|
522 |
36
| final String jvmDefautlt = System.getProperty(JPConstants.XMLConfigFilesConstants.CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM);
|
|
523 |
36
| if (null != jvmDefautlt && !"".equals(jvmDefautlt.trim()))
|
|
524 |
| { |
|
525 |
36
| LOG.debug("Please be noticed the JVM param based value for the custom consumer XML is used. This value is : " + jvmDefautlt);
|
|
526 |
36
| return jvmDefautlt;
|
|
527 |
| } |
|
528 |
0
| final IPropertiesManager propsManager = PropertiesBasedFactory.getInstance().getPropertiesManager();
|
|
529 |
0
| if (null == propsManager)
|
|
530 |
| { |
|
531 |
0
| throw new IllegalStateException("Smth. wrong with the core initialization. Properties manager can not be null.");
|
|
532 |
| } |
|
533 |
0
| final String propsValue =
|
|
534 |
| propsManager.getBundle(JPConstants.XMLConfigFilesConstants.CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_PROPS_PARAM); |
|
535 |
0
| if (null != propsValue && !"".equals(propsValue.trim()))
|
|
536 |
| { |
|
537 |
0
| LOG.debug("The properties defined value is used for the consumer custom configuration.");
|
|
538 |
0
| return propsValue;
|
|
539 |
| } |
|
540 |
0
| LOG.debug("The consumer custom configuration is not provided.");
|
|
541 |
0
| return null;
|
|
542 |
| } |
|
543 |
| |
|
544 |
| |
|
545 |
| |
|
546 |
| |
|
547 |
| |
|
548 |
| |
|
549 |
| |
|
550 |
| |
|
551 |
| |
|
552 |
| |
|
553 |
| |
|
554 |
| |
|
555 |
36
| public String getJPatternsConsumerConfigurationDirName()
|
|
556 |
| { |
|
557 |
36
| final String jvmDefautlt = System.getProperty(JPConstants.XMLConfigFilesConstants.DEFAULT_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM);
|
|
558 |
36
| if (null != jvmDefautlt && !"".equals(jvmDefautlt.trim()))
|
|
559 |
| { |
|
560 |
36
| LOG.debug("Please be noticed the JVM param based value for the default consumer XML is used. This value is : " + jvmDefautlt);
|
|
561 |
36
| return jvmDefautlt;
|
|
562 |
| } |
|
563 |
0
| final IPropertiesManager propsManager = PropertiesBasedFactory.getInstance().getPropertiesManager();
|
|
564 |
0
| if (null == propsManager)
|
|
565 |
| { |
|
566 |
0
| throw new IllegalStateException("Smth. wrong with the core initialization. Properties manager can not be null.");
|
|
567 |
| } |
|
568 |
0
| final String propsValue =
|
|
569 |
| propsManager.getBundle(JPConstants.XMLConfigFilesConstants.DEFAULT_XML_CONSUMER_CONFIG_DIR_NAME_PROPS_PARAM); |
|
570 |
0
| if (null != propsValue && !"".equals(propsValue.trim()))
|
|
571 |
| { |
|
572 |
0
| LOG.debug("The properties defined value is used for the consumer custom configuration.");
|
|
573 |
0
| return propsValue;
|
|
574 |
| } |
|
575 |
0
| LOG.debug("The consumer custom configuration is not provided.");
|
|
576 |
0
| return null;
|
|
577 |
| } |
|
578 |
| |
|
579 |
| |
|
580 |
| |
|
581 |
| |
|
582 |
76
| public boolean defaultJPatternsFrameworkConfigurationPresents()
|
|
583 |
| { |
|
584 |
76
| return (m_defaultFrameworkConfig != null);
|
|
585 |
| } |
|
586 |
| |
|
587 |
| |
|
588 |
| |
|
589 |
| |
|
590 |
55
| public boolean customJPatternsFrameworkConfigurationPresents()
|
|
591 |
| { |
|
592 |
55
| return (m_customFrameworkConfig != null);
|
|
593 |
| } |
|
594 |
| |
|
595 |
| |
|
596 |
| |
|
597 |
| |
|
598 |
36
| public boolean defaultJPatternsConsumerConfigurationPresents()
|
|
599 |
| { |
|
600 |
36
| return (m_mergedDefaultConsumerConfig != null && null != m_mergedDefaultConsumerConfig.getListOfSectionItems() &&
|
|
601 |
| !m_mergedDefaultConsumerConfig.getListOfSectionItems().isEmpty()); |
|
602 |
| } |
|
603 |
| |
|
604 |
| |
|
605 |
| |
|
606 |
| |
|
607 |
71
| public boolean customJPatternsConsumerConfigurationPresents()
|
|
608 |
| { |
|
609 |
71
| return (m_mergedCustomConsumerConfig != null && null != m_mergedCustomConsumerConfig.getListOfSectionItems() &&
|
|
610 |
| !m_mergedCustomConsumerConfig.getListOfSectionItems().isEmpty()); |
|
611 |
| } |
|
612 |
| |
|
613 |
| |
|
614 |
| |
|
615 |
| |
|
616 |
9
| public JPatternsConfigsBean getJPatternsFrameworkConfiguration()
|
|
617 |
| { |
|
618 |
9
| return m_mergedFrameworkConfig;
|
|
619 |
| } |
|
620 |
| |
|
621 |
| |
|
622 |
| |
|
623 |
| |
|
624 |
37
| public JPatternsConfigsBean getJPatternsConsumerConfiguration()
|
|
625 |
| { |
|
626 |
37
| return m_mergedConsumerConfig;
|
|
627 |
| } |
|
628 |
| |
|
629 |
| |
|
630 |
| |
|
631 |
| |
|
632 |
| |
|
633 |
| |
|
634 |
2
| protected static void setUseOnlyCustomFrameworkConfigIfPresent(final Boolean value)
|
|
635 |
| { |
|
636 |
2
| useOnlyCustomFrameworkConfigIfPresent = value;
|
|
637 |
| } |
|
638 |
| } |