Coverage Report - org.kuali.rice.kim.service.KIMServiceLocatorInternal
 
Classes in this File Line Coverage Branch Coverage Complexity
KIMServiceLocatorInternal
0%
0/17
0%
0/6
1.273
 
 1  
 /*
 2  
  * Copyright 2006-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  
 
 17  
 package org.kuali.rice.kim.service;
 18  
 
 19  
 import org.apache.log4j.Logger;
 20  
 import org.kuali.rice.core.api.config.module.RunMode;
 21  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 22  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 23  
 import org.kuali.rice.kim.api.entity.services.IdentityArchiveService;
 24  
 import org.kuali.rice.kim.api.group.GroupUpdateService;
 25  
 import org.kuali.rice.kim.impl.responsibility.ResponsibilityInternalService;
 26  
 import org.kuali.rice.kim.util.KimConstants;
 27  
 
 28  
 import javax.xml.namespace.QName;
 29  
 
 30  
 /**
 31  
  * Service locator for KIM.
 32  
  *
 33  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 34  
  *
 35  
  */
 36  0
 public final class KIMServiceLocatorInternal {
 37  
 
 38  0
         private static final Logger LOG = Logger.getLogger(KIMServiceLocatorInternal.class);
 39  
 
 40  
         public static final String KIM_RUN_MODE_PROPERTY = "kim.mode";
 41  
 
 42  
     public static final String KIM_IDENTITY_UPDATE_SERVICE = "kimIdentityUpdateService";
 43  
         public static final String KIM_IDENTITY_ARCHIVE_SERVICE = "kimIdentityArchiveService";
 44  
         public static final String KIM_GROUP_UPDATE_SERVICE = "kimGroupUpdateService";
 45  
     public static final String KIM_ROLE_UPDATE_SERVICE = "kimRoleUpdateService";
 46  
         public static final String KIM_PERMISSION_UPDATE_SERVICE = "kimPermissionUpdateService";
 47  
         public static final String KIM_AUTHENTICATION_SERVICE = "kimAuthenticationService";
 48  
     public static final String KIM_UI_DOCUMENT_SERVICE = "kimUiDocumentService";
 49  
         public static final String GROUP_INTERNAL_SERVICE = "groupInternalService";
 50  
         public static final String RESPONSIBILITY_INTERNAL_SERVICE = "responsibilityInternalService";
 51  
         
 52  
         public static Object getService(String serviceName) {
 53  0
                 return getBean(serviceName);
 54  
         }
 55  
 
 56  
         public static Object getBean(String serviceName) {
 57  0
                 if ( LOG.isDebugEnabled() ) {
 58  0
                         LOG.debug("Fetching service " + serviceName);
 59  
                 }
 60  0
                 return GlobalResourceLoader.getResourceLoader().getService(
 61  
                                 (RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KIM_RUN_MODE_PROPERTY)))) ?
 62  
                                                 new QName(KimConstants.KIM_MODULE_NAMESPACE, serviceName) : new QName(serviceName) );
 63  
         }
 64  
 
 65  
     public static IdentityUpdateService getIdentityUpdateService() {
 66  0
             return (IdentityUpdateService)getService(KIM_IDENTITY_UPDATE_SERVICE);
 67  
     }
 68  
 
 69  
     public static IdentityArchiveService getIdentityArchiveService() {
 70  0
             return (IdentityArchiveService)getService(KIM_IDENTITY_ARCHIVE_SERVICE);
 71  
     }
 72  
 
 73  
     
 74  
 
 75  
     public static GroupUpdateService getGroupUpdateService() {
 76  0
             return (GroupUpdateService)getService(KIM_GROUP_UPDATE_SERVICE);
 77  
     }
 78  
 
 79  
     public static RoleUpdateService getRoleUpdateService() {
 80  0
             return (RoleUpdateService)getService(KIM_ROLE_UPDATE_SERVICE);
 81  
     }
 82  
 
 83  
     
 84  
     public static PermissionUpdateService getPermissionUpdateService() {
 85  0
             return (PermissionUpdateService)getService(KIM_PERMISSION_UPDATE_SERVICE);
 86  
     }
 87  
 
 88  
     public static AuthenticationService getAuthenticationService() {
 89  0
             if ( LOG.isDebugEnabled() ) {
 90  0
                         LOG.debug("Fetching service " + KIM_AUTHENTICATION_SERVICE);
 91  
                 }
 92  0
             return (AuthenticationService) GlobalResourceLoader.getResourceLoader().getService(new QName(KIM_AUTHENTICATION_SERVICE));
 93  
     }
 94  
 
 95  
     public static UiDocumentService getUiDocumentService() {
 96  0
             return (UiDocumentService)getService(KIM_UI_DOCUMENT_SERVICE);
 97  
     }
 98  
 
 99  
     public static GroupInternalService getGroupInternalService() {
 100  0
         return (GroupInternalService)getService(GROUP_INTERNAL_SERVICE);
 101  
     }
 102  
 
 103  
     public static ResponsibilityInternalService getResponsibilityInternalService() {
 104  0
         return (ResponsibilityInternalService)getService(RESPONSIBILITY_INTERNAL_SERVICE);
 105  
     }
 106  
 
 107  
 }