| 1 | |
package org.kuali.rice.kim.impl.services; |
| 2 | |
|
| 3 | |
import org.apache.log4j.Logger; |
| 4 | |
import org.kuali.rice.core.api.config.module.RunMode; |
| 5 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 6 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 7 | |
import org.kuali.rice.kim.impl.responsibility.ResponsibilityInternalService; |
| 8 | |
import org.kuali.rice.kim.util.KimConstants; |
| 9 | |
|
| 10 | |
import javax.xml.namespace.QName; |
| 11 | |
|
| 12 | 0 | public class KIMServiceLocatorInternal { |
| 13 | 0 | private static final Logger LOG = Logger.getLogger(KIMServiceLocatorInternal.class); |
| 14 | |
|
| 15 | |
public static final String KIM_RUN_MODE_PROPERTY = "kim.mode"; |
| 16 | |
public static final String RESPONSIBILITY_INTERNAL_SERVICE = "responsibilityInternalService"; |
| 17 | |
|
| 18 | |
public static Object getService(String serviceName) { |
| 19 | 0 | return getBean(serviceName); |
| 20 | |
} |
| 21 | |
|
| 22 | |
public static Object getBean(String serviceName) { |
| 23 | 0 | if (LOG.isDebugEnabled()) { |
| 24 | 0 | LOG.debug("Fetching service " + serviceName); |
| 25 | |
} |
| 26 | 0 | return GlobalResourceLoader.getResourceLoader().getService( |
| 27 | |
(RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KIM_RUN_MODE_PROPERTY)))) ? |
| 28 | |
new QName(KimConstants.KIM_MODULE_NAMESPACE, serviceName) : new QName(serviceName)); |
| 29 | |
} |
| 30 | |
|
| 31 | |
public static ResponsibilityInternalService getResponsibilityInternalService() { |
| 32 | 0 | return (ResponsibilityInternalService) KIMServiceLocatorInternal.getService(RESPONSIBILITY_INTERNAL_SERVICE); |
| 33 | |
} |
| 34 | |
} |