Revision 34342
Added by Nikon Gasparis over 9 years ago
CascadingPropertyLoader.java | ||
---|---|---|
1 |
package eu.dnetlib.validator.service.config; |
|
2 |
|
|
3 |
import java.util.Properties; |
|
4 |
|
|
5 |
import org.springframework.beans.BeansException; |
|
6 |
import org.springframework.beans.factory.InitializingBean; |
|
7 |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
|
8 |
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; |
|
9 |
|
|
10 |
/** |
|
11 |
* CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties |
|
12 |
* override the previous. It also supports property expansion like: |
|
13 |
* |
|
14 |
* <code> |
|
15 |
* something = 1 |
|
16 |
* somethingelse = 2 |
|
17 |
* test = ${something}/${somethingelse} |
|
18 |
* </code> |
|
19 |
* |
|
20 |
* <p> |
|
21 |
* And if you override something to XX, then test will become XX/2 |
|
22 |
* </p> |
|
23 |
* |
|
24 |
* |
|
25 |
* @author marko |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean { |
|
29 |
|
|
30 |
private Properties properties; |
|
31 |
|
|
32 |
public void afterPropertiesSet() throws Exception { |
|
33 |
this.properties = mergeProperties(); |
|
34 |
|
|
35 |
// Convert the merged properties, if necessary. |
|
36 |
convertProperties(this.properties); |
|
37 |
|
|
38 |
logger.debug("Properties: " + properties); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException { |
|
43 |
super.processProperties(beanFactoryToProcess, props); |
|
44 |
} |
|
45 |
|
|
46 |
public Properties getProperties() { |
|
47 |
return properties; |
|
48 |
} |
|
49 |
|
|
50 |
public void setProperties(final Properties properties) { |
|
51 |
super.setProperties(properties); |
|
52 |
|
|
53 |
this.properties = properties; |
|
54 |
} |
|
55 |
} |
Also available in: Unified diff
*new version of validator service
*it now includes the validator implementation(replaces uoa-validator)
*registry for jobs,rules and providers is now removed.
*supports and implements the new ValidatorService interface
*new way to submit a new job (a common method is used for tests,registrations,or cris)
*content and usage jobs are now merged to one.
*listeners updated to support job merging
*works as standalone or with IS (BETA)