View Javadoc

1   /**
2    * Copyright 2005-2011 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.krms.api;
17  
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  import org.kuali.rice.krms.api.engine.Engine;
20  import org.kuali.rice.krms.api.repository.RuleRepositoryService;
21  import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService;
22  
23  import javax.xml.namespace.QName;
24  
25  /**
26   * A static service locator which aids in locating the various remotable services that form the Kuali Rule Management System API.
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class KrmsApiServiceLocator {
31  
32  	public static final String ENGINE = "rice.krms.engine";
33  	public static final QName RULE_REPOSITORY_SERVICE = new QName(KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0, "ruleRepositoryService");
34      public static final QName KRMS_TYPE_REPOSITORY_SERVICE = new QName(KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0, "krmsTypeRepositoryService");
35  
36      static <T> T getService(String serviceName) {
37          return GlobalResourceLoader.<T>getService(serviceName);
38      }
39  
40      static <T> T getService(QName serviceName) {
41          return GlobalResourceLoader.<T>getService(serviceName);
42      }
43  
44      public static Engine getEngine() {
45          return getService(ENGINE);
46      }
47      
48      public static RuleRepositoryService getRuleRepositoryService() {
49      	return getService(RULE_REPOSITORY_SERVICE);
50      }
51  
52      public static KrmsTypeRepositoryService getKrmsTypeRepositoryService() {
53          return getService(KRMS_TYPE_REPOSITORY_SERVICE);
54      }
55  
56  }