| 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.core.api.resourceloader.GlobalResourceLoader; |
| 24 | |
import org.kuali.rice.kim.util.KimConstants; |
| 25 | |
|
| 26 | |
import javax.xml.namespace.QName; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | 0 | public final class KIMServiceLocatorInternal { |
| 35 | |
|
| 36 | 0 | private static final Logger LOG = Logger.getLogger(KIMServiceLocatorInternal.class); |
| 37 | |
|
| 38 | |
public static final String KIM_RUN_MODE_PROPERTY = "kim.mode"; |
| 39 | |
|
| 40 | |
public static final String KIM_IDENTITY_UPDATE_SERVICE = "kimIdentityUpdateService"; |
| 41 | |
public static final String KIM_IDENTITY_ARCHIVE_SERVICE = "kimIdentityArchiveService"; |
| 42 | |
public static final String KIM_GROUP_UPDATE_SERVICE = "kimGroupUpdateService"; |
| 43 | |
public static final String KIM_ROLE_UPDATE_SERVICE = "kimRoleUpdateService"; |
| 44 | |
public static final String KIM_PERMISSION_UPDATE_SERVICE = "kimPermissionUpdateService"; |
| 45 | |
public static final String KIM_RESPONSIBILITY_UPDATE_SERVICE = "kimResponsibilityUpdateService"; |
| 46 | |
public static final String KIM_AUTHENTICATION_SERVICE = "kimAuthenticationService"; |
| 47 | |
public static final String KIM_UI_DOCUMENT_SERVICE = "kimUiDocumentService"; |
| 48 | |
public static final String GROUP_INTERNAL_SERVICE = "groupInternalService"; |
| 49 | |
public static final String RESPONSIBILITY_INTERNAL_SERVICE = "responsibilityInternalService"; |
| 50 | |
|
| 51 | |
public static Object getService(String serviceName) { |
| 52 | 0 | return getBean(serviceName); |
| 53 | |
} |
| 54 | |
|
| 55 | |
public static Object getBean(String serviceName) { |
| 56 | 0 | if ( LOG.isDebugEnabled() ) { |
| 57 | 0 | LOG.debug("Fetching service " + serviceName); |
| 58 | |
} |
| 59 | 0 | return GlobalResourceLoader.getResourceLoader().getService( |
| 60 | |
(RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KIM_RUN_MODE_PROPERTY)))) ? |
| 61 | |
new QName(KimConstants.KIM_MODULE_NAMESPACE, serviceName) : new QName(serviceName) ); |
| 62 | |
} |
| 63 | |
|
| 64 | |
public static IdentityUpdateService getIdentityUpdateService() { |
| 65 | 0 | return (IdentityUpdateService)getService(KIM_IDENTITY_UPDATE_SERVICE); |
| 66 | |
} |
| 67 | |
|
| 68 | |
public static IdentityArchiveService getIdentityArchiveService() { |
| 69 | 0 | return (IdentityArchiveService)getService(KIM_IDENTITY_ARCHIVE_SERVICE); |
| 70 | |
} |
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
public static GroupUpdateService getGroupUpdateService() { |
| 75 | 0 | return (GroupUpdateService)getService(KIM_GROUP_UPDATE_SERVICE); |
| 76 | |
} |
| 77 | |
|
| 78 | |
public static RoleUpdateService getRoleUpdateService() { |
| 79 | 0 | return (RoleUpdateService)getService(KIM_ROLE_UPDATE_SERVICE); |
| 80 | |
} |
| 81 | |
|
| 82 | |
|
| 83 | |
public static PermissionUpdateService getPermissionUpdateService() { |
| 84 | 0 | return (PermissionUpdateService)getService(KIM_PERMISSION_UPDATE_SERVICE); |
| 85 | |
} |
| 86 | |
|
| 87 | |
public static ResponsibilityUpdateService getResponsibilityUpdateService() { |
| 88 | 0 | return (ResponsibilityUpdateService)getService(KIM_RESPONSIBILITY_UPDATE_SERVICE); |
| 89 | |
} |
| 90 | |
|
| 91 | |
public static AuthenticationService getAuthenticationService() { |
| 92 | 0 | if ( LOG.isDebugEnabled() ) { |
| 93 | 0 | LOG.debug("Fetching service " + KIM_AUTHENTICATION_SERVICE); |
| 94 | |
} |
| 95 | 0 | return (AuthenticationService) GlobalResourceLoader.getResourceLoader().getService(new QName(KIM_AUTHENTICATION_SERVICE)); |
| 96 | |
} |
| 97 | |
|
| 98 | |
public static UiDocumentService getUiDocumentService() { |
| 99 | 0 | return (UiDocumentService)getService(KIM_UI_DOCUMENT_SERVICE); |
| 100 | |
} |
| 101 | |
|
| 102 | |
public static GroupInternalService getGroupInternalService() { |
| 103 | 0 | return (GroupInternalService)getService(GROUP_INTERNAL_SERVICE); |
| 104 | |
} |
| 105 | |
|
| 106 | |
public static ResponsibilityInternalService getResponsibilityInternalService() { |
| 107 | 0 | return (ResponsibilityInternalService)getService(RESPONSIBILITY_INTERNAL_SERVICE); |
| 108 | |
} |
| 109 | |
|
| 110 | |
} |