1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.impl.util; |
17 | |
|
18 | |
import javax.xml.namespace.QName; |
19 | |
|
20 | |
import org.apache.log4j.Logger; |
21 | |
import org.kuali.rice.core.api.config.module.RunMode; |
22 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
23 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public class KRMSServiceLocatorInternal { |
31 | |
|
32 | |
public static final String KRMS_RUN_MODE_PROPERTY = "krms.mode"; |
33 | |
public static final String KRMS_MODULE_NAMESPACE = "KRMS"; |
34 | |
public static final String VALIDATION_ACTION_SERVICE = "validationActionService"; |
35 | |
public static final String VALIDATION_RULE_SERVICE = "validationRuleService"; |
36 | |
|
37 | 0 | private static final Logger LOG = Logger.getLogger(KRMSServiceLocatorInternal.class); |
38 | |
|
39 | |
|
40 | |
@SuppressWarnings("unchecked") |
41 | |
public static <A> A getService(String serviceName) { |
42 | 0 | return (A)getBean(serviceName); |
43 | |
} |
44 | |
|
45 | |
public static Object getBean(String serviceName) { |
46 | 0 | if ( LOG.isDebugEnabled() ) { |
47 | 0 | LOG.debug("Fetching service " + serviceName); |
48 | |
} |
49 | 0 | return GlobalResourceLoader.getResourceLoader().getService( |
50 | |
(RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KRMS_RUN_MODE_PROPERTY)))) ? |
51 | |
new QName(KRMS_MODULE_NAMESPACE, serviceName) : new QName(serviceName) ); |
52 | |
} |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
} |