1 | |
package de.jollyday.parameter; |
2 | |
|
3 | |
import java.net.URL; |
4 | |
import java.util.Properties; |
5 | |
|
6 | |
import de.jollyday.util.ResourceUtil; |
7 | |
|
8 | |
public class CalendarPartManagerParameter extends BaseManagerParameter { |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
private static final String FILE_PREFIX = "holidays/Holidays"; |
14 | |
|
15 | |
|
16 | |
|
17 | |
private static final String FILE_SUFFIX = ".xml"; |
18 | |
|
19 | |
|
20 | |
|
21 | 1264 | private ResourceUtil resourceUtil = new ResourceUtil(); |
22 | |
|
23 | |
private String calendarPart; |
24 | |
|
25 | |
public CalendarPartManagerParameter(String calendarPart, |
26 | |
Properties properties) { |
27 | 1258 | super(properties); |
28 | 1267 | this.calendarPart = calendarPart; |
29 | 1265 | } |
30 | |
|
31 | |
@Override |
32 | |
public String createCacheKey() { |
33 | 1260 | return calendarPart; |
34 | |
} |
35 | |
|
36 | |
@Override |
37 | |
public String getDisplayName() { |
38 | 0 | return calendarPart; |
39 | |
} |
40 | |
|
41 | |
@Override |
42 | |
public URL createResourceUrl() { |
43 | 76 | String configurationFileName = getConfigurationFileName(calendarPart); |
44 | 76 | return resourceUtil.getResource(configurationFileName); |
45 | |
} |
46 | |
|
47 | |
@Override |
48 | |
public String getManangerImplClassName() { |
49 | 1262 | String className = getProperty(MANAGER_IMPL_CLASS_PREFIX + "." |
50 | |
+ calendarPart); |
51 | 1260 | if (className == null) { |
52 | 159 | className = super.getManangerImplClassName(); |
53 | |
} |
54 | 1260 | return className; |
55 | |
} |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
public static String getConfigurationFileName(final String country) { |
65 | 76 | return FILE_PREFIX + "_" + country + FILE_SUFFIX; |
66 | |
} |
67 | |
|
68 | |
@Override |
69 | |
public String toString() { |
70 | 0 | return this.getClass().getSimpleName() + " - " + this.calendarPart; |
71 | |
} |
72 | |
|
73 | |
} |