1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.service;
17
18 import org.kuali.rice.core.api.config.property.ConfigurationService;
19 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20
21 import javax.persistence.EntityManagerFactory;
22
23 public class KRADServiceLocator {
24 public static final String ATTACHMENT_SERVICE = "attachmentService";
25 public static final String PERSISTENCE_SERVICE = "persistenceService";
26 public static final String PERSISTENCE_STRUCTURE_SERVICE = "persistenceStructureService";
27 public static final String NOTE_SERVICE = "noteService";
28 public static final String BUSINESS_OBJECT_SERVICE = "businessObjectService";
29 public static final String KUALI_CONFIGURATION_SERVICE = "kualiConfigurationService";
30 public static final String ENTITY_MANAGER_FACTORY = "entityManagerFactory";
31 public static final String APPLICATION_ENTITY_MANAGER_FACTORY = "kradApplicationEntityManagerFactory";
32 public static final String XML_OBJECT_SERIALIZER_SERVICE = "xmlObjectSerializerService";
33 public static final String XML_OBJECT_SERIALIZER_IGNORE_MISSING_FIELDS_SERVICE = "xmlObjectSerializerIgnoreMissingFieldsService";
34 public static final String SERIALIZER_SERVICE = "businessObjectSerializerService";
35 public static final String SEQUENCE_ACCESSOR_SERVICE = "sequenceAccessorService";
36 public static final String KEY_VALUES_SERVICE = "keyValuesService";
37
38 static <T> T getService(String serviceName) {
39 return GlobalResourceLoader.<T>getService(serviceName);
40 }
41
42 public static AttachmentService getAttachmentService() {
43 return getService(ATTACHMENT_SERVICE);
44 }
45
46 public static PersistenceService getPersistenceService() {
47 return getService(PERSISTENCE_SERVICE);
48 }
49
50 public static PersistenceStructureService getPersistenceStructureService() {
51 return getService(PERSISTENCE_STRUCTURE_SERVICE);
52 }
53
54 public static NoteService getNoteService() {
55 return getService(NOTE_SERVICE);
56 }
57
58 public static BusinessObjectService getBusinessObjectService() {
59 return getService(BUSINESS_OBJECT_SERVICE);
60 }
61
62 public static ConfigurationService getKualiConfigurationService() {
63 return getService(KUALI_CONFIGURATION_SERVICE);
64 }
65
66 public static EntityManagerFactory getEntityManagerFactory() {
67 return getService(ENTITY_MANAGER_FACTORY);
68 }
69
70 public static EntityManagerFactory getApplicationEntityManagerFactory() {
71 return getService(APPLICATION_ENTITY_MANAGER_FACTORY);
72 }
73
74 public static XmlObjectSerializerService getXmlObjectSerializerService() {
75 return getService(XML_OBJECT_SERIALIZER_SERVICE);
76 }
77
78 public static XmlObjectSerializerService getXmlObjectSerializerIgnoreMissingFieldsService() {
79 return getService(XML_OBJECT_SERIALIZER_IGNORE_MISSING_FIELDS_SERVICE);
80 }
81
82 public static BusinessObjectSerializerService getBusinessObjectSerializerService() {
83 return getService(SERIALIZER_SERVICE);
84 }
85
86 public static SequenceAccessorService getSequenceAccessorService() {
87 return getService(SEQUENCE_ACCESSOR_SERVICE);
88 }
89
90 public static KeyValuesService getKeyValuesService() {
91 return getService(KEY_VALUES_SERVICE);
92 }
93
94 }