1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.identity.IdentityService;
21 import org.kuali.rice.kim.api.responsibility.ResponsibilityService;
22 import org.kuali.rice.kim.api.role.RoleService;
23 import org.kuali.rice.kim.api.type.KimTypeInfoService;
24 import org.kuali.rice.kim.api.permission.PermissionService;
25 import org.kuali.rice.kim.api.identity.PersonService;
26
27 public class KimApiServiceLocator {
28 private static final Logger LOG = Logger.getLogger(KimApiServiceLocator.class);
29
30 public static final String KIM_GROUP_SERVICE = "kimGroupService";
31 public static final String KIM_IDENTITY_SERVICE = "kimIdentityService";
32 public static final String KIM_PERMISSION_SERVICE = "kimPermissionService";
33 public static final String KIM_RESPONSIBILITY_SERVICE = "kimResponsibilityService";
34 public static final String KIM_ROLE_SERVICE = "kimRoleService";
35 public static final String KIM_PERSON_SERVICE = "personService";
36 public static final String KIM_TYPE_INFO_SERVICE = "kimTypeInfoService";
37
38 static <T> T getService(String serviceName) {
39 return GlobalResourceLoader.<T>getService(serviceName);
40 }
41
42 public static KimTypeInfoService getKimTypeInfoService() {
43 return getService(KIM_TYPE_INFO_SERVICE);
44 }
45
46 public static PersonService getPersonService() {
47 if (LOG.isDebugEnabled()) {
48 LOG.debug("Fetching service " + KIM_PERSON_SERVICE);
49 }
50 return getService(KIM_PERSON_SERVICE);
51 }
52
53 public static RoleService getRoleService() {
54 return getService(KIM_ROLE_SERVICE);
55 }
56
57 public static org.kuali.rice.kim.api.group.GroupService getGroupService() {
58 return getService(KIM_GROUP_SERVICE);
59 }
60
61 public static IdentityService getIdentityService() {
62 return getService(KIM_IDENTITY_SERVICE);
63 }
64 public static PermissionService getPermissionService() {
65 return getService(KIM_PERMISSION_SERVICE);
66 }
67 public static ResponsibilityService getResponsibilityService() {
68 return getService(KIM_RESPONSIBILITY_SERVICE);
69 }
70 }