View Javadoc

1   /**
2    * Copyright 2005-2013 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.api.services;
17  
18  import org.apache.log4j.Logger;
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.rice.kim.api.group.GroupService;
21  import org.kuali.rice.kim.api.identity.IdentityService;
22  import org.kuali.rice.kim.api.identity.PersonService;
23  import org.kuali.rice.kim.api.permission.PermissionService;
24  import org.kuali.rice.kim.api.responsibility.ResponsibilityService;
25  import org.kuali.rice.kim.api.role.RoleService;
26  import org.kuali.rice.kim.api.type.KimTypeInfoService;
27  
28  public class KimApiServiceLocator {
29  
30      private static final Logger LOG = Logger.getLogger(KimApiServiceLocator.class);
31  
32      public static final String KIM_GROUP_SERVICE = "kimGroupService";
33      public static final String KIM_IDENTITY_SERVICE = "kimIdentityService";
34      public static final String KIM_PERMISSION_SERVICE = "kimPermissionService";
35      public static final String KIM_RESPONSIBILITY_SERVICE = "kimResponsibilityService";
36      public static final String KIM_ROLE_SERVICE = "kimRoleService";
37      public static final String KIM_PERSON_SERVICE = "personService";
38      public static final String KIM_TYPE_INFO_SERVICE = "kimTypeInfoService";
39  
40      static <T> T getService(String serviceName) {
41          return GlobalResourceLoader.<T>getService(serviceName);
42      }
43  
44      public static KimTypeInfoService getKimTypeInfoService() {
45          return getService(KIM_TYPE_INFO_SERVICE);
46      }
47  
48      public static PersonService getPersonService() {
49          return getService(KIM_PERSON_SERVICE);
50      }
51  
52      public static RoleService getRoleService() {
53          return getService(KIM_ROLE_SERVICE);
54      }
55      
56      public static GroupService getGroupService() {
57      	return getService(KIM_GROUP_SERVICE);
58      }
59      
60      public static IdentityService getIdentityService() {
61      	return getService(KIM_IDENTITY_SERVICE);
62      }
63      public static PermissionService getPermissionService() {
64      	return getService(KIM_PERMISSION_SERVICE);
65      }
66      public static ResponsibilityService getResponsibilityService() {
67      	return getService(KIM_RESPONSIBILITY_SERVICE);
68      }
69      
70  }