View Javadoc

1   package org.kuali.rice.ksb.api;
2   
3   import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
4   import org.kuali.rice.ksb.api.bus.ServiceBus;
5   import org.kuali.rice.ksb.api.cache.RiceCacheAdministrator;
6   import org.kuali.rice.ksb.api.messaging.MessageHelper;
7   import org.kuali.rice.ksb.api.registry.ServiceRegistry;
8   
9   /**
10   * A static service locator which aids in locating the various services that
11   * form the Kuali Service Bus API.
12   */
13  public class KsbApiServiceLocator {
14  
15  	public static final String SERVICE_BUS = "rice.ksb.serviceBus";
16  	public static final String SERVICE_REGISTRY = "rice.ksb.serviceRegistry";
17      public static final String CACHE_ADMINISTRATOR = "enCacheAdministrator";
18      public static final String MESSAGE_HELPER = "rice.ksb.messageHelper";
19  
20      static <T> T getService(String serviceName) {
21          return GlobalResourceLoader.<T>getService(serviceName);
22      }
23  
24      public static ServiceBus getServiceBus() {
25          return getService(SERVICE_BUS);
26      }
27      
28      public static ServiceRegistry getServiceRegistry() {
29      	return getService(SERVICE_REGISTRY);
30      }
31  
32      public static RiceCacheAdministrator getCacheAdministrator() {
33          return getService(CACHE_ADMINISTRATOR);
34      }
35  
36      public static MessageHelper getMessageHelper() {
37          return getService(MESSAGE_HELPER);
38      }
39  }