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.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 | |
|
32 | |
|
33 | |
|
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 | |
} |