001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.service;
017    
018    import org.kuali.rice.coreservice.api.namespace.NamespaceService;
019    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
020    import org.kuali.rice.core.framework.persistence.platform.DatabasePlatform;
021    import org.kuali.rice.kns.service.BusinessObjectAuthorizationService;
022    import org.kuali.rice.krad.dao.BusinessObjectDao;
023    import org.kuali.rice.krad.dao.DocumentDao;
024    import org.kuali.rice.krad.util.OjbCollectionHelper;
025    import org.kuali.rice.krad.workflow.service.WorkflowAttributePropertyResolutionService;
026    import org.springframework.transaction.PlatformTransactionManager;
027    import org.springframework.transaction.support.TransactionTemplate;
028    
029    public class KRADServiceLocatorInternal {
030    
031        public static final String VALIDATION_COMPLETION_UTILS = "validationCompletionUtils";
032    
033        public static <T extends Object> T getService(String serviceName) {
034            return GlobalResourceLoader.<T>getService(serviceName);
035        }
036    
037    
038        public static final String MAIL_SERVICE = "mailService";
039    
040        public static final MailService getMailService() {
041            return (MailService) getService(MAIL_SERVICE);
042        }
043    
044        public static final String POST_PROCESSOR_SERVICE = "postProcessorService";
045    
046        public static PostProcessorService getPostProcessorService() {
047            return (PostProcessorService) getService(POST_PROCESSOR_SERVICE);
048        }
049    
050        public static final String NAMESPACE_SERVICE = "namespaceService";
051    
052        public static NamespaceService getNamespaceService() {
053            return (NamespaceService) getService(NAMESPACE_SERVICE);
054        }
055    
056        public static final String OJB_COLLECTION_HELPER = "ojbCollectionHelper";
057    
058        public static OjbCollectionHelper getOjbCollectionHelper() {
059            return (OjbCollectionHelper) getService(OJB_COLLECTION_HELPER);
060        }
061    
062        public static final String TRANSACTION_MANAGER = "transactionManager";
063    
064        public static PlatformTransactionManager getTransactionManager() {
065            return (PlatformTransactionManager) getService(TRANSACTION_MANAGER);
066        }
067    
068        public static final String TRANSACTION_TEMPLATE = "transactionTemplate";
069    
070        public static TransactionTemplate getTransactionTemplate() {
071            return (TransactionTemplate) getService(TRANSACTION_TEMPLATE);
072        }
073    
074        public static final String INACTIVATION_BLOCKING_DISPLAY_SERVICE = "inactivationBlockingDisplayService";
075        
076        public static InactivationBlockingDisplayService getInactivationBlockingDisplayService() {
077            return (InactivationBlockingDisplayService) getService(INACTIVATION_BLOCKING_DISPLAY_SERVICE);
078        }
079    
080        public static final String DATA_DICTIONARY_COMPONENT_PUBLISHER_SERVICE = "dataDictionaryComponentPublisherService";
081    
082        public static DataDictionaryComponentPublisherService getDataDictionaryComponentPublisherService() {
083            return getService(DATA_DICTIONARY_COMPONENT_PUBLISHER_SERVICE);
084        }
085    
086        
087        public static final String DOCUMENT_DAO = "documentDao";
088        
089        public static DocumentDao getDocumentDao() {
090            return (DocumentDao) getService(DOCUMENT_DAO);
091        }
092        
093        public static final String BUSINESS_OBJECT_DAO = "businessObjectDao";
094        
095        public static BusinessObjectDao getBusinessObjectDao() {
096            return (BusinessObjectDao) getService(BUSINESS_OBJECT_DAO);
097        }
098        
099    
100       public static final String DB_PLATFORM = "dbPlatform";
101        
102        public static DatabasePlatform getDatabasePlatform() {
103            return (DatabasePlatform) getService(DB_PLATFORM);
104        }
105        
106        public static final String MAINTENANCE_DOCUMENT_AUTHORIZATION_SERVICE = "maintenanceDocumentAuthorizationService";
107        
108        public static BusinessObjectAuthorizationService getMaintenanceDocumentAuthorizationService() {
109            return (BusinessObjectAuthorizationService) getService(MAINTENANCE_DOCUMENT_AUTHORIZATION_SERVICE);
110        }
111    
112        public static final String WORKFLOW_ATTRIBUTE_PROPERTY_RESOLUTION_SERVICE = "workflowAttributesPropertyResolutionService";
113        
114        public static WorkflowAttributePropertyResolutionService getWorkflowAttributePropertyResolutionService() {
115            return (WorkflowAttributePropertyResolutionService) getService(WORKFLOW_ATTRIBUTE_PROPERTY_RESOLUTION_SERVICE);
116        }
117        
118        public static final String INACTIVATEABLE_FROM_TO_SERVICE = "inactivateableFromToService";
119        
120        public static InactivateableFromToService getInactivateableFromToService() {
121            return (InactivateableFromToService) getService(INACTIVATEABLE_FROM_TO_SERVICE);
122        }
123        
124    }