Revision 41502854
Added by Andreas Müller over 2 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/opt/config/DataSourceProperties.java | ||
---|---|---|
14 | 14 |
/** |
15 | 15 |
* @author a.kohlbecker |
16 | 16 |
* @since Oct 5, 2012 |
17 |
* |
|
18 | 17 |
*/ |
19 | 18 |
public class DataSourceProperties { |
20 | 19 |
|
21 | 20 |
private static final String CDMLIB_REMOTE_XSL_BASE_PATH = "cdmlib-remote.xslBasePath"; |
22 | 21 |
|
22 |
private static final Properties emptyProperties = new Properties(); |
|
23 |
|
|
23 | 24 |
private String currentDataSourceId = null; |
24 | 25 |
|
25 | 26 |
private Map<String, Properties> propsMap; |
26 | 27 |
|
28 |
|
|
29 |
public DataSourceProperties() { |
|
30 |
super(); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
27 | 34 |
public Map<String, Properties> getPropsMap() { |
28 | 35 |
return propsMap; |
29 | 36 |
} |
30 |
|
|
31 | 37 |
public void setPropsMap(Map<String, Properties> propsMap) { |
32 | 38 |
this.propsMap = propsMap; |
33 | 39 |
} |
34 | 40 |
|
35 |
private static final Properties emptyProperties = new Properties(); |
|
36 | 41 |
|
37 | 42 |
public String getCurrentDataSourceId() { |
38 | 43 |
return currentDataSourceId; |
39 | 44 |
} |
40 |
|
|
41 | 45 |
/** |
42 | 46 |
* will be set by {@link DataSourceConfigurer} only |
43 |
* |
|
44 |
* @param currentDataSourceId |
|
45 | 47 |
*/ |
46 | 48 |
protected void setCurrentDataSourceId(String currentDataSourceId) { |
47 | 49 |
this.currentDataSourceId = currentDataSourceId; |
48 | 50 |
} |
49 | 51 |
|
50 |
public DataSourceProperties() { |
|
51 |
super(); |
|
52 |
} |
|
53 |
|
|
54 | 52 |
/** |
55 | 53 |
* returns the XslBasePath for the current data source from the cdm bean definition file |
56 | 54 |
* |
57 | 55 |
* This file is usually {@code ./.cdmLibrary/datasources.xml} |
58 |
* |
|
59 |
* @param beanName |
|
60 |
* @return |
|
61 | 56 |
*/ |
62 | 57 |
public String getXslBasePath(String defaultPath) { |
63 | 58 |
|
64 | 59 |
String xslBasePath = currentDataSourceProperties().getProperty(CDMLIB_REMOTE_XSL_BASE_PATH, defaultPath); |
65 | 60 |
xslBasePath = xslBasePath.replaceAll("/$", ""); |
66 | 61 |
return xslBasePath; |
67 |
|
|
68 | 62 |
} |
69 | 63 |
|
70 | 64 |
private Properties currentDataSourceProperties() { |
... | ... | |
77 | 71 |
|
78 | 72 |
return emptyProperties; |
79 | 73 |
} |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
} |
|
74 |
} |
Also available in: Unified diff
cleanup