Revision 2da9ade2
Added by Andreas Kohlbecker about 7 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
private static CdmApplicationState cdmApplicationState; |
49 | 49 |
|
50 |
private ICdmApplicationConfiguration appConfig;
|
|
50 |
private ICdmRepository appConfig;
|
|
51 | 51 |
|
52 | 52 |
private ICdmDataChangeService dataChangeService; |
53 | 53 |
|
... | ... | |
66 | 66 |
return cdmApplicationState; |
67 | 67 |
} |
68 | 68 |
|
69 |
public void setAppConfig(ICdmApplicationConfiguration appConfig) {
|
|
69 |
public void setAppConfig(ICdmRepository appConfig) {
|
|
70 | 70 |
this.appConfig = appConfig; |
71 | 71 |
if(appConfig instanceof CdmApplicationRemoteController) { |
72 | 72 |
CdmBase.setNewEntityListener(new DefaultNewEntityListener()); |
... | ... | |
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
|
78 |
public ICdmApplicationConfiguration getAppConfig() {
|
|
78 |
public ICdmRepository getAppConfig() {
|
|
79 | 79 |
return appConfig; |
80 | 80 |
} |
81 | 81 |
|
82 |
public static void setCurrentAppConfig(ICdmApplicationConfiguration appConfig) {
|
|
82 |
public static void setCurrentAppConfig(ICdmRepository appConfig) {
|
|
83 | 83 |
getInstance().setAppConfig(appConfig); |
84 | 84 |
} |
85 | 85 |
|
86 |
public static ICdmApplicationConfiguration getCurrentAppConfig() {
|
|
86 |
public static ICdmRepository getCurrentAppConfig() {
|
|
87 | 87 |
return getInstance().getAppConfig(); |
88 | 88 |
} |
89 | 89 |
|
... | ... | |
151 | 151 |
|
152 | 152 |
|
153 | 153 |
/** |
154 |
* Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
|
|
154 |
* Generic method that will scan the getters of {@link ICdmRepository} for the given service
|
|
155 | 155 |
* interface. If a matching getter is found the according service implementation is returned by |
156 | 156 |
* invoking the getter otherwise the method returns <code>null</code>. |
157 | 157 |
* |
... | ... | |
161 | 161 |
* @throws CdmApplicationException |
162 | 162 |
*/ |
163 | 163 |
public static <T extends IService> T getService(Class<T> serviceClass) throws CdmApplicationException { |
164 |
ICdmApplicationConfiguration configuration = getCurrentAppConfig();
|
|
164 |
ICdmRepository configuration = getCurrentAppConfig();
|
|
165 | 165 |
|
166 |
Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
|
|
166 |
Method[] methods = ICdmRepository.class.getDeclaredMethods();
|
|
167 | 167 |
|
168 | 168 |
T service = null; |
169 | 169 |
|
... | ... | |
193 | 193 |
* As ICommonService is not extending IService we need a specific request here |
194 | 194 |
*/ |
195 | 195 |
public static ICommonService getCommonService() { |
196 |
ICdmApplicationConfiguration configuration = getCurrentAppConfig();
|
|
196 |
ICdmRepository configuration = getCurrentAppConfig();
|
|
197 | 197 |
|
198 | 198 |
return configuration.getCommonService(); |
199 | 199 |
|
200 | 200 |
} |
201 | 201 |
|
202 | 202 |
public static IIOService getIOService() { |
203 |
ICdmApplicationConfiguration configuration = getCurrentAppConfig();
|
|
203 |
ICdmRepository configuration = getCurrentAppConfig();
|
|
204 | 204 |
|
205 | 205 |
return ((CdmApplicationRemoteController)configuration).getIOService(); |
206 | 206 |
|
... | ... | |
208 | 208 |
|
209 | 209 |
|
210 | 210 |
public static ITestService getTestService() { |
211 |
ICdmApplicationConfiguration configuration = getCurrentAppConfig();
|
|
211 |
ICdmRepository configuration = getCurrentAppConfig();
|
|
212 | 212 |
|
213 | 213 |
return ((CdmApplicationRemoteController)configuration).getTestService(); |
214 | 214 |
|
215 | 215 |
} |
216 | 216 |
|
217 | 217 |
public static ICachedCommonService getCachedCommonService() { |
218 |
ICdmApplicationConfiguration configuration = getCurrentAppConfig();
|
|
218 |
ICdmRepository configuration = getCurrentAppConfig();
|
|
219 | 219 |
|
220 | 220 |
return ((CdmApplicationRemoteController)configuration).getCachedCommonService(); |
221 | 221 |
|
Also available in: Unified diff
ref #6419 renaming CdmApplicationDefaultConfiguration to CdmRepository