1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.impl.repository; |
17 | |
|
18 | |
import org.apache.log4j.Logger; |
19 | |
import org.kuali.rice.core.api.criteria.CriteriaLookupService; |
20 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
21 | |
import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService; |
22 | |
import org.kuali.rice.krms.impl.authorization.AgendaAuthorizationService; |
23 | |
import org.kuali.rice.krms.impl.provider.repository.RepositoryToEngineTranslator; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public final class KrmsRepositoryServiceLocator { |
32 | |
|
33 | 0 | private KrmsRepositoryServiceLocator() { |
34 | |
|
35 | 0 | } |
36 | |
|
37 | 0 | private static final Logger LOG = Logger.getLogger(KrmsRepositoryServiceLocator.class); |
38 | |
|
39 | |
public static final String KRMS_ATTRIBUTE_DEFINITION_SERVICE = "krmsAttributeDefinitionService"; |
40 | |
public static final String KRMS_TYPE_REPOSITORY_SERVICE = "krmsTypeRepositoryService"; |
41 | |
public static final String CRITERIA_LOOKUP_SERVICE = "criteriaLookupService"; |
42 | |
public static final String KRMS_CONTEXT_BO_SERVICE = "contextBoService"; |
43 | |
public static final String KRMS_AGENDA_BO_SERVICE = "agendaBoService"; |
44 | |
public static final String KRMS_TERM_BO_SERVICE = "termBoService"; |
45 | |
public static final String KRMS_RULE_BO_SERVICE = "ruleBoService"; |
46 | |
public static final String KRMS_AGENDA_AUTHORIZATION_SERVICE = "agendaAuthorizationService"; |
47 | |
public static final String KRMS_REPOSITORY_TO_ENGINE_TRANSLATOR = "repositoryToEngineTranslator"; |
48 | |
|
49 | |
private static KrmsAttributeDefinitionService krmsAttributeDefinitionService; |
50 | |
private static ContextBoService contextBoService; |
51 | |
private static TermBoService termBoService; |
52 | |
private static AgendaBoService agendaBoService; |
53 | |
private static RuleBoService ruleBoService; |
54 | |
private static AgendaAuthorizationService agendaAuthorizationService; |
55 | |
private static KrmsTypeRepositoryService krmsTypeRepositoryService; |
56 | |
private static RepositoryToEngineTranslator krmsRepositoryToEngineTranslator; |
57 | |
|
58 | |
public static <T extends Object> T getService(String serviceName) { |
59 | 0 | return KrmsRepositoryServiceLocator.<T>getBean(serviceName); |
60 | |
} |
61 | |
|
62 | |
public static <T extends Object> T getBean(String serviceName) { |
63 | 0 | if ( LOG.isDebugEnabled() ) { |
64 | 0 | LOG.debug("Fetching service " + serviceName); |
65 | |
} |
66 | 0 | return GlobalResourceLoader.<T>getService(serviceName); |
67 | |
} |
68 | |
|
69 | |
public static KrmsAttributeDefinitionService getKrmsAttributeDefinitionService() { |
70 | 0 | if ( krmsAttributeDefinitionService == null ) { |
71 | 0 | krmsAttributeDefinitionService = getService(KRMS_ATTRIBUTE_DEFINITION_SERVICE); |
72 | |
} |
73 | 0 | return krmsAttributeDefinitionService; |
74 | |
} |
75 | |
|
76 | |
public static CriteriaLookupService getCriteriaLookupService() { |
77 | 0 | return getService(CRITERIA_LOOKUP_SERVICE); |
78 | |
} |
79 | |
|
80 | |
public static void setKrmsAttributeDefinitionService(final KrmsAttributeDefinitionService service) { |
81 | 0 | krmsAttributeDefinitionService = service; |
82 | 0 | } |
83 | |
|
84 | |
public static ContextBoService getContextBoService() { |
85 | 0 | if (contextBoService == null) { |
86 | 0 | contextBoService = getService(KRMS_CONTEXT_BO_SERVICE); |
87 | |
} |
88 | 0 | return contextBoService; |
89 | |
} |
90 | |
|
91 | |
public static TermBoService getTermBoService() { |
92 | 0 | if (termBoService == null) { |
93 | 0 | termBoService = getService(KRMS_TERM_BO_SERVICE); |
94 | |
} |
95 | 0 | return termBoService; |
96 | |
} |
97 | |
|
98 | |
public static AgendaBoService getAgendaBoService() { |
99 | 0 | if (agendaBoService == null) { |
100 | 0 | agendaBoService = getService(KRMS_AGENDA_BO_SERVICE); |
101 | |
} |
102 | 0 | return agendaBoService; |
103 | |
} |
104 | |
|
105 | |
public static RuleBoService getRuleBoService() { |
106 | 0 | if (ruleBoService == null) { |
107 | 0 | ruleBoService = getService(KRMS_RULE_BO_SERVICE); |
108 | |
} |
109 | 0 | return ruleBoService; |
110 | |
} |
111 | |
|
112 | |
public static AgendaAuthorizationService getAgendaAuthorizationService() { |
113 | 0 | if (agendaAuthorizationService == null) { |
114 | 0 | agendaAuthorizationService = getService(KRMS_AGENDA_AUTHORIZATION_SERVICE); |
115 | |
} |
116 | 0 | return agendaAuthorizationService; |
117 | |
} |
118 | |
|
119 | |
public static KrmsTypeRepositoryService getKrmsTypeRepositoryService() { |
120 | 0 | if (krmsTypeRepositoryService == null) { |
121 | 0 | krmsTypeRepositoryService = getService(KRMS_TYPE_REPOSITORY_SERVICE); |
122 | |
} |
123 | 0 | return krmsTypeRepositoryService; |
124 | |
} |
125 | |
|
126 | |
public static RepositoryToEngineTranslator getKrmsRepositoryToEngineTranslator() { |
127 | 0 | if (krmsRepositoryToEngineTranslator == null) { |
128 | 0 | krmsRepositoryToEngineTranslator = getService(KRMS_REPOSITORY_TO_ENGINE_TRANSLATOR); |
129 | |
} |
130 | 0 | return krmsRepositoryToEngineTranslator; |
131 | |
} |
132 | |
} |