Coverage Report - org.kuali.rice.kim.impl.services.KimImplServiceLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
KimImplServiceLocator
0%
0/11
0%
0/4
1.286
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kim.impl.services;
 17  
 
 18  
 import org.apache.log4j.Logger;
 19  
 import org.kuali.rice.core.api.config.module.RunMode;
 20  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 21  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 22  
 import org.kuali.rice.kim.api.KimConstants;
 23  
 import org.kuali.rice.kim.impl.group.GroupInternalService;
 24  
 import org.kuali.rice.kim.impl.responsibility.ResponsibilityInternalService;
 25  
 import org.kuali.rice.kim.impl.role.RoleDao;
 26  
 import org.kuali.rice.kim.impl.role.RoleInternalService;
 27  
 import org.springframework.cache.CacheManager;
 28  
 
 29  
 import javax.xml.namespace.QName;
 30  
 
 31  0
 public class KimImplServiceLocator {
 32  0
     private static final Logger LOG = Logger.getLogger(KimImplServiceLocator.class);
 33  
 
 34  
     public static final String KIM_RUN_MODE_PROPERTY = "kim.mode";
 35  
     public static final String RESPONSIBILITY_INTERNAL_SERVICE = "responsibilityInternalService";
 36  
     public static final String GROUP_INTERNAL_SERVICE = "groupInternalService";
 37  
     public static final String ROLE_INTERNAL_SERVICE = "kimRoleInternalService";
 38  
     public static final String LOCAL_CACHE_MANAGER = "kimLocalCacheManager";
 39  
 
 40  
     public static final String KIM_ROLE_DAO = "kimRoleDao";
 41  
 
 42  
     public static Object getService(String serviceName) {
 43  0
         return getBean(serviceName);
 44  
     }
 45  
 
 46  
     public static Object getBean(String serviceName) {
 47  0
         if (LOG.isDebugEnabled()) {
 48  0
             LOG.debug("Fetching service " + serviceName);
 49  
         }
 50  0
         return GlobalResourceLoader.getResourceLoader().getService(
 51  
                 (RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KIM_RUN_MODE_PROPERTY)))) ?
 52  
                         new QName(KimConstants.KIM_MODULE_NAMESPACE, serviceName) : new QName(serviceName));
 53  
     }
 54  
 
 55  
     public static ResponsibilityInternalService getResponsibilityInternalService() {
 56  0
         return (ResponsibilityInternalService) getService(RESPONSIBILITY_INTERNAL_SERVICE);
 57  
     }
 58  
 
 59  
     public static GroupInternalService getGroupInternalService() {
 60  0
         return (GroupInternalService) getService(GROUP_INTERNAL_SERVICE);
 61  
     }
 62  
 
 63  
     public static RoleInternalService getRoleInternalService() {
 64  0
         return (RoleInternalService) getService(ROLE_INTERNAL_SERVICE);
 65  
     }
 66  
 
 67  
     public static CacheManager getLocalCacheManager() {
 68  0
         return (CacheManager) getService(LOCAL_CACHE_MANAGER);
 69  
     }
 70  
 
 71  
     public static RoleDao getRoleDao() {
 72  0
         return (RoleDao) getService(KIM_ROLE_DAO);
 73  
     }
 74  
 }