View Javadoc

1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.api;
17  
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  import org.kuali.rice.ksb.api.bus.ServiceBus;
20  import org.kuali.rice.ksb.api.messaging.MessageHelper;
21  import org.kuali.rice.ksb.api.registry.ServiceRegistry;
22  
23  /**
24   * A static service locator which aids in locating the various services that
25   * form the Kuali Service Bus API.
26   */
27  public class KsbApiServiceLocator {
28  
29  	public static final String SERVICE_BUS = "rice.ksb.serviceBus";
30  	public static final String SERVICE_REGISTRY = "rice.ksb.serviceRegistry";
31      public static final String MESSAGE_HELPER = "rice.ksb.messageHelper";
32  
33      static <T> T getService(String serviceName) {
34          return GlobalResourceLoader.<T>getService(serviceName);
35      }
36  
37      public static ServiceBus getServiceBus() {
38          return getService(SERVICE_BUS);
39      }
40      
41      public static ServiceRegistry getServiceRegistry() {
42      	return getService(SERVICE_REGISTRY);
43      }
44  
45      public static MessageHelper getMessageHelper() {
46          return getService(MESSAGE_HELPER);
47      }
48  }