1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.edl.impl.service;
18
19 import javax.xml.namespace.QName;
20
21 import org.apache.log4j.Logger;
22 import org.kuali.rice.core.api.config.module.RunMode;
23 import org.kuali.rice.core.api.config.property.ConfigContext;
24 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
25 import org.kuali.rice.kew.service.KEWServiceLocator;
26 import org.kuali.rice.kew.util.KEWConstants;
27
28 public class EdlServiceLocator {
29
30 private static final Logger LOG = Logger.getLogger(EdlServiceLocator.class);
31
32 public static final String EDL_RUN_MODE_PROPERTY = "edl.mode";
33 public static final String EDOCLITE_SERVICE = "enEDocLiteService";
34
35
36 static <T> T getService(String serviceName) {
37 return GlobalResourceLoader.<T>getService(serviceName);
38 }
39
40 public static EDocLiteService getEDocLiteService() {
41 return getService(EDOCLITE_SERVICE);
42 }
43
44 public static Object getBean(String serviceName) {
45 if ( LOG.isDebugEnabled() ) {
46 LOG.debug("Fetching service " + serviceName);
47 }
48 return GlobalResourceLoader.getResourceLoader().getService(
49 (RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(EDL_RUN_MODE_PROPERTY)))) ?
50 new QName(KEWConstants.KEW_MODULE_NAMESPACE, serviceName) : new QName(serviceName));
51 }
52
53 }