1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.service; |
17 | |
|
18 | |
import javax.persistence.EntityManagerFactory; |
19 | |
import javax.sql.DataSource; |
20 | |
import javax.transaction.TransactionManager; |
21 | |
import javax.transaction.UserTransaction; |
22 | |
import javax.xml.namespace.QName; |
23 | |
|
24 | |
import org.apache.log4j.Logger; |
25 | |
import org.kuali.rice.core.config.ConfigContext; |
26 | |
import org.kuali.rice.core.config.ModuleConfigurer; |
27 | |
import org.kuali.rice.core.config.NodeSettings; |
28 | |
import org.kuali.rice.core.resourceloader.GlobalResourceLoader; |
29 | |
import org.kuali.rice.core.resourceloader.RiceResourceLoaderFactory; |
30 | |
import org.kuali.rice.core.service.EncryptionService; |
31 | |
import org.kuali.rice.kew.actionlist.service.ActionListService; |
32 | |
import org.kuali.rice.kew.actionrequest.service.ActionRequestService; |
33 | |
import org.kuali.rice.kew.actions.ActionRegistry; |
34 | |
import org.kuali.rice.kew.actiontaken.service.ActionTakenService; |
35 | |
import org.kuali.rice.kew.batch.XmlDigesterService; |
36 | |
import org.kuali.rice.kew.batch.XmlIngesterService; |
37 | |
import org.kuali.rice.kew.batch.XmlPollerService; |
38 | |
import org.kuali.rice.kew.docsearch.service.DocumentSearchService; |
39 | |
import org.kuali.rice.kew.doctype.service.DocumentSecurityService; |
40 | |
import org.kuali.rice.kew.doctype.service.DocumentTypePermissionService; |
41 | |
import org.kuali.rice.kew.doctype.service.DocumentTypeService; |
42 | |
import org.kuali.rice.kew.documentlink.service.DocumentLinkService; |
43 | |
import org.kuali.rice.kew.edl.extract.ExtractService; |
44 | |
import org.kuali.rice.kew.edl.service.EDocLiteService; |
45 | |
import org.kuali.rice.kew.edl.service.StyleService; |
46 | |
import org.kuali.rice.kew.engine.WorkflowEngine; |
47 | |
import org.kuali.rice.kew.engine.node.service.BranchService; |
48 | |
import org.kuali.rice.kew.engine.node.service.RouteNodeService; |
49 | |
import org.kuali.rice.kew.exception.WorkflowDocumentExceptionRoutingService; |
50 | |
import org.kuali.rice.kew.help.service.HelpService; |
51 | |
import org.kuali.rice.kew.identity.service.IdentityHelperService; |
52 | |
import org.kuali.rice.kew.mail.service.ActionListEmailService; |
53 | |
import org.kuali.rice.kew.mail.service.EmailContentService; |
54 | |
import org.kuali.rice.kew.mail.service.EmailService; |
55 | |
import org.kuali.rice.kew.notes.service.NoteService; |
56 | |
import org.kuali.rice.kew.notification.service.NotificationService; |
57 | |
import org.kuali.rice.kew.preferences.service.PreferencesService; |
58 | |
import org.kuali.rice.kew.removereplace.service.RemoveReplaceDocumentService; |
59 | |
import org.kuali.rice.kew.responsibility.service.ResponsibilityIdService; |
60 | |
import org.kuali.rice.kew.role.service.RoleService; |
61 | |
import org.kuali.rice.kew.routeheader.service.RouteHeaderService; |
62 | |
import org.kuali.rice.kew.routeheader.service.WorkflowDocumentService; |
63 | |
import org.kuali.rice.kew.routemodule.service.RouteModuleService; |
64 | |
import org.kuali.rice.kew.routemodule.service.RoutingReportService; |
65 | |
import org.kuali.rice.kew.rule.service.RuleAttributeService; |
66 | |
import org.kuali.rice.kew.rule.service.RuleDelegationService; |
67 | |
import org.kuali.rice.kew.rule.service.RuleService; |
68 | |
import org.kuali.rice.kew.rule.service.RuleTemplateService; |
69 | |
import org.kuali.rice.kew.useroptions.UserOptionsService; |
70 | |
import org.kuali.rice.kew.util.KEWConstants; |
71 | |
import org.kuali.rice.kew.xml.export.XmlExporterService; |
72 | |
import org.kuali.rice.ksb.cache.RiceCacheAdministrator; |
73 | |
import org.springframework.transaction.PlatformTransactionManager; |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | 0 | public final class KEWServiceLocator { |
86 | |
|
87 | 0 | private static final Logger LOG = Logger.getLogger(KEWServiceLocator.class); |
88 | |
|
89 | |
public static final String KEW_RUN_MODE_PROPERTY = "kew.mode"; |
90 | |
|
91 | |
public static final String DATASOURCE = "enWorkflowDataSource"; |
92 | |
|
93 | |
public static final String QUICK_LINKS_SERVICE = "enQuickLinksService"; |
94 | |
|
95 | |
public static final String DOCUMENT_SEARCH_SERVICE = "enDocumentSearchService"; |
96 | |
|
97 | |
public static final String ACTION_TAKEN_SRV = "enActionTakenService"; |
98 | |
|
99 | |
public static final String ACTION_REQUEST_SRV = "enActionRequestService"; |
100 | |
|
101 | |
public static final String ACTION_LIST_SRV = "enActionListService"; |
102 | |
|
103 | |
public static final String DOC_ROUTE_HEADER_SRV = "enDocumentRouteHeaderService"; |
104 | |
|
105 | |
public static final String DOCUMENT_TYPE_GROUP_SERVICE = "enDocumentTypeGroupService"; |
106 | |
|
107 | |
public static final String DOCUMENT_TYPE_SERVICE = "enDocumentTypeService"; |
108 | |
|
109 | |
public static final String DOCUMENT_TYPE_PERMISSION_SERVICE = "enDocumentTypePermissionService"; |
110 | |
|
111 | |
public static final String DOCUMENT_SECURITY_SERVICE = "enDocumentSecurityService"; |
112 | |
|
113 | |
public static final String USER_OPTIONS_SRV = "enUserOptionsService"; |
114 | |
|
115 | |
public static final String DOCUMENT_CHANGE_HISTORY_SRV = "enDocumentChangeHistoryService"; |
116 | |
|
117 | |
public static final String DOCUMENT_VALUE_INDEX_SRV = "enDocumentValueIndexService"; |
118 | |
|
119 | |
public static final String ROUTE_LEVEL_SERVICE = "enRouteLevelService"; |
120 | |
|
121 | |
public static final String CONSTANTS_SERVICE = "enApplicationConstantsService"; |
122 | |
|
123 | |
public static final String PREFERENCES_SERVICE = "enPreferencesService"; |
124 | |
|
125 | |
public static final String ROUTE_LOG_SERVICE = "enRouteLogService"; |
126 | |
|
127 | |
public static final String RULE_TEMPLATE_SERVICE = "enRuleTemplateService"; |
128 | |
|
129 | |
public static final String RULE_SERVICE = "enRuleService"; |
130 | |
|
131 | |
public static final String RULE_ATTRIBUTE_SERVICE = "enRuleAttributeService"; |
132 | |
|
133 | |
public static final String RULE_TEMPLATE_ATTRIBUTE_SERVICE = "enRuleTemplateAttributeService"; |
134 | |
|
135 | |
public static final String ROLE_SERVICE = "enRoleService"; |
136 | |
|
137 | |
public static final String RESPONSIBILITY_ID_SERVICE = "enResponsibilityIdService"; |
138 | |
|
139 | |
public static final String STATS_SERVICE = "enStatsService"; |
140 | |
|
141 | |
public static final String ROUTE_MANAGER_QUEUE_SERVICE = "enRouteManagerQueueService"; |
142 | |
|
143 | |
public static final String ROUTE_MANAGER_CONTROLLER = "enRouteManagerController"; |
144 | |
|
145 | |
public static final String RULE_DELEGATION_SERVICE = "enRuleDelegationService"; |
146 | |
|
147 | |
public static final String ROUTE_MANAGER_DRIVER = "enRouteManagerDriver"; |
148 | |
|
149 | |
public static final String OPTIMISTIC_LOCK_FAILURE_SERVICE = "enOptimisticLockFailureService"; |
150 | |
|
151 | |
public static final String NOTE_SERVICE = "enNoteService"; |
152 | |
|
153 | |
public static final String ROUTING_REPORT_SERVICE = "enRoutingReportService"; |
154 | |
|
155 | |
public static final String ROUTE_MODULE_SERVICE = "enRouteModuleService"; |
156 | |
|
157 | |
public static final String EXCEPTION_ROUTING_SERVICE = "enExceptionRoutingService"; |
158 | |
|
159 | |
public static final String ACTION_REGISTRY = "enActionRegistry"; |
160 | |
|
161 | |
public static final String BRANCH_SERVICE = "enBranchService"; |
162 | |
|
163 | |
public static final String WORKFLOW_MBEAN = "workflowMBean"; |
164 | |
|
165 | |
public static final String NODE_SETTINGS = "nodeSettings"; |
166 | |
|
167 | |
public static final String APPLICATION_CONSTANTS_CACHE = "applicationConstantsCache"; |
168 | |
|
169 | |
public static final String JTA_TRANSACTION_MANAGER = "jtaTransactionManager"; |
170 | |
|
171 | |
public static final String USER_TRANSACTION = "userTransaction"; |
172 | |
|
173 | |
public static final String CACHE_ADMINISTRATOR = "enCacheAdministrator"; |
174 | |
|
175 | |
public static final String SCHEDULER = "enScheduler"; |
176 | |
|
177 | |
public static final String DOCUMENT_LINK_SERVICE = "enDocumentLinkService"; |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
public static final String XML_POLLER_SERVICE = "enXmlPollerService"; |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
public static final String XML_INGESTER_SERVICE = "enXmlIngesterService"; |
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
public static final String XML_DIGESTER_SERVICE = "enXmlDigesterService"; |
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
public static final String XML_EXPORTER_SERVICE = "enXmlExporterService"; |
198 | |
|
199 | |
public static final String DB_TABLES_LOADER = "enDbTablesLoader"; |
200 | |
|
201 | |
public static final String ROUTE_NODE_SERVICE = "enRouteNodeService"; |
202 | |
|
203 | |
public static final String WORKFLOW_ENGINE = "workflowEngine"; |
204 | |
|
205 | |
public static final String EDOCLITE_SERVICE = "enEDocLiteService"; |
206 | |
|
207 | |
public static final String STYLE_SERVICE = "enStyleService"; |
208 | |
|
209 | |
public static final String ACTION_LIST_EMAIL_SERVICE = "enActionListEmailService"; |
210 | |
|
211 | |
public static final String IMMEDIATE_EMAIL_REMINDER_SERVICE = "enImmediateEmailReminderService"; |
212 | |
|
213 | |
public static final String EMAIL_SERVICE = "enEmailService"; |
214 | |
|
215 | |
public static final String EMAIL_CONTENT_SERVICE = "enEmailContentService"; |
216 | |
|
217 | |
public static final String NOTIFICATION_SERVICE = "enNotificationService"; |
218 | |
|
219 | |
public static final String TRANSACTION_MANAGER = "transactionManager"; |
220 | |
|
221 | |
public static final String TRANSACTION_TEMPLATE = "transactionTemplate"; |
222 | |
|
223 | |
public static final String HELP_SERVICE = "enHelpService"; |
224 | |
|
225 | |
public static final String WORKFLOW_DOCUMENT_SERVICE = "enWorkflowDocumentService"; |
226 | |
|
227 | |
public static final String EXTENSION_SERVICE = "enExtensionService"; |
228 | |
|
229 | |
public static final String TRANSFORMATION_SERVICE = "enTransformationService"; |
230 | |
|
231 | |
public static final String ENCRYPTION_SERVICE = "enEncryptionService"; |
232 | |
|
233 | |
public static final String REMOVE_REPLACE_DOCUMENT_SERVICE = "enRemoveReplaceDocumentService"; |
234 | |
|
235 | |
public static final String EXTRACT_SERVICE = "enExtractService"; |
236 | |
|
237 | |
public static final String IDENTITY_HELPER_SERVICE = "kewIdentityHelperService"; |
238 | |
|
239 | |
public static final String ENTITY_MANAGER_FACTORY = "kewEntityManagerFactory"; |
240 | |
|
241 | |
|
242 | |
public static EntityManagerFactory getEntityManagerFactory() { |
243 | 0 | return (EntityManagerFactory) getService(ENTITY_MANAGER_FACTORY); |
244 | |
} |
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
public static Object getService(String serviceName) { |
253 | 0 | return getBean(serviceName); |
254 | |
} |
255 | |
|
256 | |
public static Object getBean(String serviceName) { |
257 | 0 | if ( LOG.isDebugEnabled() ) { |
258 | 0 | LOG.debug("Fetching service " + serviceName); |
259 | |
} |
260 | 0 | return GlobalResourceLoader.getResourceLoader().getService( |
261 | |
(ModuleConfigurer.REMOTE_RUN_MODE.equals(ConfigContext.getCurrentContextConfig().getProperty(KEW_RUN_MODE_PROPERTY))) ? |
262 | |
new QName(KEWConstants.KEW_MODULE_NAMESPACE, serviceName) : new QName(serviceName)); |
263 | |
} |
264 | |
|
265 | |
public static WorkflowUtility getWorkflowUtilityService() { |
266 | 0 | if ( LOG.isDebugEnabled() ) { |
267 | 0 | LOG.debug("Fetching service " + KEWConstants.WORKFLOW_UTILITY_SERVICE); |
268 | |
} |
269 | 0 | return (WorkflowUtility) GlobalResourceLoader.getResourceLoader().getService(new QName(KEWConstants.WORKFLOW_UTILITY_SERVICE)); |
270 | |
} |
271 | |
|
272 | |
public static WorkflowDocumentActions getWorkflowDocumentActionsService() { |
273 | 0 | if ( LOG.isDebugEnabled() ) { |
274 | 0 | LOG.debug("Fetching service " + KEWConstants.WORKFLOW_DOCUMENT_ACTIONS_SERVICE); |
275 | |
} |
276 | 0 | return (WorkflowDocumentActions) GlobalResourceLoader.getResourceLoader().getService(new QName(KEWConstants.WORKFLOW_DOCUMENT_ACTIONS_SERVICE)); |
277 | |
} |
278 | |
|
279 | |
public static DocumentTypeService getDocumentTypeService() { |
280 | 0 | return (DocumentTypeService) getBean(DOCUMENT_TYPE_SERVICE); |
281 | |
} |
282 | |
|
283 | |
public static DocumentTypePermissionService getDocumentTypePermissionService() { |
284 | 0 | return (DocumentTypePermissionService) getBean(DOCUMENT_TYPE_PERMISSION_SERVICE); |
285 | |
} |
286 | |
|
287 | |
public static DocumentSecurityService getDocumentSecurityService() { |
288 | 0 | return (DocumentSecurityService) getBean(DOCUMENT_SECURITY_SERVICE); |
289 | |
} |
290 | |
|
291 | |
|
292 | |
public static ActionRequestService getActionRequestService() { |
293 | 0 | return (ActionRequestService) getBean(ACTION_REQUEST_SRV); |
294 | |
} |
295 | |
|
296 | |
public static ActionTakenService getActionTakenService() { |
297 | 0 | return (ActionTakenService) getBean(ACTION_TAKEN_SRV); |
298 | |
} |
299 | |
|
300 | |
public static ResponsibilityIdService getResponsibilityIdService() { |
301 | 0 | return (ResponsibilityIdService) getBean(RESPONSIBILITY_ID_SERVICE); |
302 | |
} |
303 | |
|
304 | |
public static RouteHeaderService getRouteHeaderService() { |
305 | 0 | return (RouteHeaderService) getBean(DOC_ROUTE_HEADER_SRV); |
306 | |
} |
307 | |
|
308 | |
public static RuleTemplateService getRuleTemplateService() { |
309 | 0 | return (RuleTemplateService) getBean(RULE_TEMPLATE_SERVICE); |
310 | |
} |
311 | |
|
312 | |
public static RuleAttributeService getRuleAttributeService() { |
313 | 0 | return (RuleAttributeService) getBean(RULE_ATTRIBUTE_SERVICE); |
314 | |
} |
315 | |
|
316 | |
public static WorkflowDocumentService getWorkflowDocumentService() { |
317 | 0 | return (WorkflowDocumentService) getBean(WORKFLOW_DOCUMENT_SERVICE); |
318 | |
} |
319 | |
|
320 | |
public static RouteModuleService getRouteModuleService() { |
321 | 0 | return (RouteModuleService) getBean(ROUTE_MODULE_SERVICE); |
322 | |
} |
323 | |
|
324 | |
public static RoleService getRoleService() { |
325 | 0 | return (RoleService) getBean(ROLE_SERVICE); |
326 | |
} |
327 | |
|
328 | |
public static RuleService getRuleService() { |
329 | 0 | return (RuleService) getBean(RULE_SERVICE); |
330 | |
} |
331 | |
|
332 | |
public static RuleDelegationService getRuleDelegationService() { |
333 | 0 | return (RuleDelegationService) getBean(RULE_DELEGATION_SERVICE); |
334 | |
} |
335 | |
|
336 | |
public static HelpService getHelpService() { |
337 | 0 | return (HelpService) getBean(HELP_SERVICE); |
338 | |
} |
339 | |
|
340 | |
public static RoutingReportService getRoutingReportService() { |
341 | 0 | return (RoutingReportService) getBean(ROUTING_REPORT_SERVICE); |
342 | |
} |
343 | |
|
344 | |
public static PreferencesService getPreferencesService() { |
345 | 0 | return (PreferencesService) getBean(PREFERENCES_SERVICE); |
346 | |
} |
347 | |
|
348 | |
public static XmlPollerService getXmlPollerService() { |
349 | 0 | return (XmlPollerService) getBean(XML_POLLER_SERVICE); |
350 | |
} |
351 | |
|
352 | |
public static XmlIngesterService getXmlIngesterService() { |
353 | 0 | return (XmlIngesterService) getBean(XML_INGESTER_SERVICE); |
354 | |
} |
355 | |
|
356 | |
public static XmlDigesterService getXmlDigesterService() { |
357 | 0 | return (XmlDigesterService) getBean(XML_DIGESTER_SERVICE); |
358 | |
} |
359 | |
|
360 | |
public static XmlExporterService getXmlExporterService() { |
361 | 0 | return (XmlExporterService) getBean(XML_EXPORTER_SERVICE); |
362 | |
} |
363 | |
|
364 | |
public static UserOptionsService getUserOptionsService() { |
365 | 0 | return (UserOptionsService) getBean(USER_OPTIONS_SRV); |
366 | |
} |
367 | |
|
368 | |
public static ActionListService getActionListService() { |
369 | 0 | return (ActionListService) getBean(ACTION_LIST_SRV); |
370 | |
} |
371 | |
|
372 | |
public static RouteNodeService getRouteNodeService() { |
373 | 0 | return (RouteNodeService) getBean(ROUTE_NODE_SERVICE); |
374 | |
} |
375 | |
|
376 | |
public static WorkflowEngine getWorkflowEngine() { |
377 | 0 | return (WorkflowEngine) getBean(WORKFLOW_ENGINE); |
378 | |
} |
379 | |
|
380 | |
public static EDocLiteService getEDocLiteService() { |
381 | 0 | return (EDocLiteService) getBean(EDOCLITE_SERVICE); |
382 | |
} |
383 | |
|
384 | |
public static StyleService getStyleService() { |
385 | 0 | return (StyleService) getBean(STYLE_SERVICE); |
386 | |
} |
387 | |
|
388 | |
public static WorkflowDocumentExceptionRoutingService getExceptionRoutingService() { |
389 | 0 | return (WorkflowDocumentExceptionRoutingService) getBean(EXCEPTION_ROUTING_SERVICE); |
390 | |
} |
391 | |
|
392 | |
public static ActionListEmailService getActionListEmailService() { |
393 | 0 | return (ActionListEmailService) getBean(KEWServiceLocator.ACTION_LIST_EMAIL_SERVICE); |
394 | |
} |
395 | |
|
396 | |
public static EmailService getEmailService() { |
397 | 0 | return (EmailService) getBean(KEWServiceLocator.EMAIL_SERVICE); |
398 | |
} |
399 | |
|
400 | |
public static EmailContentService getEmailContentService() { |
401 | 0 | return (EmailContentService) getBean(KEWServiceLocator.EMAIL_CONTENT_SERVICE); |
402 | |
} |
403 | |
|
404 | |
public static NotificationService getNotificationService() { |
405 | 0 | return (NotificationService) getBean(KEWServiceLocator.NOTIFICATION_SERVICE); |
406 | |
} |
407 | |
|
408 | |
public static TransactionManager getTransactionManager() { |
409 | 0 | return (TransactionManager) getBean(JTA_TRANSACTION_MANAGER); |
410 | |
} |
411 | |
|
412 | |
public static UserTransaction getUserTransaction() { |
413 | 0 | return (UserTransaction) getBean(USER_TRANSACTION); |
414 | |
} |
415 | |
|
416 | |
public static NoteService getNoteService() { |
417 | 0 | return (NoteService) getBean(NOTE_SERVICE); |
418 | |
} |
419 | |
|
420 | |
public static ActionRegistry getActionRegistry() { |
421 | 0 | return (ActionRegistry) getBean(ACTION_REGISTRY); |
422 | |
} |
423 | |
|
424 | |
public static NodeSettings getNodeSettings() { |
425 | 0 | return (NodeSettings) getBean(NODE_SETTINGS); |
426 | |
} |
427 | |
|
428 | |
public static RiceCacheAdministrator getCacheAdministrator() { |
429 | 0 | return (RiceCacheAdministrator) getBean(CACHE_ADMINISTRATOR); |
430 | |
} |
431 | |
|
432 | |
public static EncryptionService getEncryptionService() { |
433 | 0 | return (EncryptionService) getBean(ENCRYPTION_SERVICE); |
434 | |
} |
435 | |
|
436 | |
public static BranchService getBranchService() { |
437 | 0 | return (BranchService) getBean(BRANCH_SERVICE); |
438 | |
} |
439 | |
|
440 | |
public static DocumentSearchService getDocumentSearchService() { |
441 | 0 | return (DocumentSearchService) getBean(DOCUMENT_SEARCH_SERVICE); |
442 | |
} |
443 | |
|
444 | |
public static RemoveReplaceDocumentService getRemoveReplaceDocumentService() { |
445 | 0 | return (RemoveReplaceDocumentService) getBean(REMOVE_REPLACE_DOCUMENT_SERVICE); |
446 | |
} |
447 | |
|
448 | |
public static ExtractService getExtractService() { |
449 | 0 | return (ExtractService) getBean(EXTRACT_SERVICE); |
450 | |
} |
451 | |
|
452 | |
public static IdentityHelperService getIdentityHelperService() { |
453 | 0 | return (IdentityHelperService) getBean(IDENTITY_HELPER_SERVICE); |
454 | |
} |
455 | |
|
456 | |
public static DocumentLinkService getDocumentLinkService(){ |
457 | 0 | return (DocumentLinkService) getBean(DOCUMENT_LINK_SERVICE); |
458 | |
} |
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
public static DataSource getDataSource() { |
466 | 0 | return (DataSource) RiceResourceLoaderFactory.getSpringResourceLoader().getContext().getBean(DATASOURCE); |
467 | |
} |
468 | |
|
469 | |
public static PlatformTransactionManager getPlatformTransactionManager() { |
470 | 0 | return (PlatformTransactionManager) RiceResourceLoaderFactory.getSpringResourceLoader().getContext().getBean(TRANSACTION_MANAGER); |
471 | |
} |
472 | |
} |