1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.engine.expression.ComparisonOperatorService;
21 import org.kuali.rice.krms.api.repository.RuleRepositoryService;
22 import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService;
23
24 import javax.xml.namespace.QName;
25
26
27
28
29
30
31 public class KrmsApiServiceLocator {
32
33 public static final String ENGINE = "rice.krms.engine";
34 public static final QName RULE_REPOSITORY_SERVICE = new QName(KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0, "ruleRepositoryService");
35 public static final QName KRMS_TYPE_REPOSITORY_SERVICE = new QName(KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0, "krmsTypeRepositoryService");
36 public static final String COMPARISON_SERVICE = "comparisonOperatorService";
37
38
39
40
41
42
43
44 static <T> T getService(String serviceName) {
45 return GlobalResourceLoader.<T>getService(QName.valueOf(serviceName));
46 }
47
48
49
50
51
52
53
54 static <T> T getService(QName serviceName) {
55 return GlobalResourceLoader.<T>getService(serviceName);
56 }
57
58
59
60
61
62 public static Engine getEngine() {
63 return getService(ENGINE);
64 }
65
66
67
68
69
70 public static RuleRepositoryService getRuleRepositoryService() {
71 return getService(RULE_REPOSITORY_SERVICE);
72 }
73
74
75
76
77
78 public static KrmsTypeRepositoryService getKrmsTypeRepositoryService() {
79 return getService(KRMS_TYPE_REPOSITORY_SERVICE);
80 }
81
82
83
84
85
86 public static ComparisonOperatorService getComparisonOperatorService() {
87 return getService(COMPARISON_SERVICE);
88 }
89 }