1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.services.IdentityArchiveService;
24 import org.kuali.rice.kim.api.group.GroupUpdateService;
25 import org.kuali.rice.kim.api.role.RoleUpdateService;
26 import org.kuali.rice.kim.impl.responsibility.ResponsibilityInternalService;
27 import org.kuali.rice.kim.util.KimConstants;
28
29 import javax.xml.namespace.QName;
30
31
32
33
34
35
36
37 public final class KIMServiceLocatorInternal {
38
39 private static final Logger LOG = Logger.getLogger(KIMServiceLocatorInternal.class);
40
41 public static final String KIM_RUN_MODE_PROPERTY = "kim.mode";
42
43 public static final String KIM_IDENTITY_UPDATE_SERVICE = "kimIdentityUpdateService";
44 public static final String KIM_IDENTITY_ARCHIVE_SERVICE = "kimIdentityArchiveService";
45 public static final String KIM_GROUP_UPDATE_SERVICE = "kimGroupUpdateService";
46 public static final String KIM_ROLE_UPDATE_SERVICE = "kimRoleUpdateService";
47 public static final String KIM_PERMISSION_UPDATE_SERVICE = "kimPermissionUpdateService";
48 public static final String KIM_AUTHENTICATION_SERVICE = "kimAuthenticationService";
49 public static final String KIM_UI_DOCUMENT_SERVICE = "kimUiDocumentService";
50 public static final String GROUP_INTERNAL_SERVICE = "groupInternalService";
51
52 public static Object getService(String serviceName) {
53 return getBean(serviceName);
54 }
55
56 public static Object getBean(String serviceName) {
57 if ( LOG.isDebugEnabled() ) {
58 LOG.debug("Fetching service " + serviceName);
59 }
60 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 return (IdentityUpdateService)getService(KIM_IDENTITY_UPDATE_SERVICE);
67 }
68
69 public static IdentityArchiveService getIdentityArchiveService() {
70 return (IdentityArchiveService)getService(KIM_IDENTITY_ARCHIVE_SERVICE);
71 }
72
73
74
75 public static GroupUpdateService getGroupUpdateService() {
76 return (GroupUpdateService)getService(KIM_GROUP_UPDATE_SERVICE);
77 }
78
79 public static RoleUpdateService getRoleUpdateService() {
80 return (RoleUpdateService)getService(KIM_ROLE_UPDATE_SERVICE);
81 }
82
83
84 public static PermissionUpdateService getPermissionUpdateService() {
85 return (PermissionUpdateService)getService(KIM_PERMISSION_UPDATE_SERVICE);
86 }
87
88 public static AuthenticationService getAuthenticationService() {
89 if ( LOG.isDebugEnabled() ) {
90 LOG.debug("Fetching service " + KIM_AUTHENTICATION_SERVICE);
91 }
92 return (AuthenticationService) GlobalResourceLoader.getResourceLoader().getService(new QName(KIM_AUTHENTICATION_SERVICE));
93 }
94
95 public static UiDocumentService getUiDocumentService() {
96 return (UiDocumentService)getService(KIM_UI_DOCUMENT_SERVICE);
97 }
98
99 public static GroupInternalService getGroupInternalService() {
100 return (GroupInternalService)getService(GROUP_INTERNAL_SERVICE);
101 }
102
103 }