Coverage Report - org.kuali.rice.ksb.service.KSBServiceLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
KSBServiceLocator
0%
0/28
N/A
1.174
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.ksb.service;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import javax.persistence.EntityManagerFactory;
 21  
 import javax.sql.DataSource;
 22  
 
 23  
 import org.apache.cxf.Bus;
 24  
 import org.apache.cxf.bus.CXFBusImpl;
 25  
 import org.apache.cxf.endpoint.ServerRegistry;
 26  
 import org.apache.cxf.interceptor.Interceptor;
 27  
 import org.apache.cxf.message.Message;
 28  
 import org.apache.cxf.transport.servlet.ServletTransportFactory;
 29  
 import org.kuali.rice.core.api.exception.RiceRemoteServiceConnectionException;
 30  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 31  
 import org.kuali.rice.ksb.api.messaging.MessageHelper;
 32  
 import org.kuali.rice.ksb.messaging.bam.service.BAMService;
 33  
 import org.kuali.rice.ksb.messaging.exceptionhandling.ExceptionRoutingService;
 34  
 import org.kuali.rice.ksb.messaging.service.BusAdminService;
 35  
 import org.kuali.rice.ksb.messaging.service.MessageQueueService;
 36  
 import org.kuali.rice.ksb.messaging.serviceexporters.ServiceExportManager;
 37  
 import org.kuali.rice.ksb.messaging.threadpool.KSBScheduledPool;
 38  
 import org.kuali.rice.ksb.messaging.threadpool.KSBThreadPool;
 39  
 import org.kuali.rice.ksb.security.admin.service.JavaSecurityManagementService;
 40  
 import org.kuali.rice.ksb.security.service.DigitalSignatureService;
 41  
 import org.kuali.rice.ksb.util.KSBConstants;
 42  
 import org.quartz.Scheduler;
 43  
 import org.springframework.transaction.PlatformTransactionManager;
 44  
 import org.springframework.transaction.support.TransactionTemplate;
 45  
 
 46  
 
 47  0
 public class KSBServiceLocator {
 48  
     public static Object getService(String name) {
 49  0
         return GlobalResourceLoader.getService(name);
 50  
     }
 51  
 
 52  
     public static EntityManagerFactory getMessageEntityManagerFactory() {
 53  0
         return (EntityManagerFactory) getService(KSBConstants.ServiceNames.MESSAGE_ENTITY_MANAGER_FACTORY);
 54  
     }
 55  
     
 56  
     public static EntityManagerFactory getRegistryEntityManagerFactory() {
 57  0
         return (EntityManagerFactory) getService(KSBConstants.ServiceNames.REGISTRY_ENTITY_MANAGER_FACTORY);
 58  
     }
 59  
     
 60  
     public static TransactionTemplate getTransactionTemplate() {
 61  0
         return (TransactionTemplate) getService(KSBConstants.ServiceNames.TRANSACTION_TEMPLATE);
 62  
     }
 63  
 
 64  
     public static PlatformTransactionManager getPlatformTransactionManager() {
 65  0
         return (PlatformTransactionManager) getService(KSBConstants.ServiceNames.TRANSACTION_MANAGER);
 66  
     }
 67  
 
 68  
     public static BAMService getBAMService() {
 69  0
         return (BAMService) getService(KSBConstants.ServiceNames.BAM_SERVICE);
 70  
     }
 71  
 
 72  
     public static MessageQueueService getMessageQueueService() {
 73  0
         return (MessageQueueService) getService(KSBConstants.ServiceNames.MESSAGE_QUEUE_SERVICE);
 74  
     }
 75  
 
 76  
     public static ExceptionRoutingService getExceptionRoutingService() {
 77  0
         return (ExceptionRoutingService) getService(KSBConstants.ServiceNames.EXCEPTION_MESSAGING_SERVICE);
 78  
     }
 79  
     
 80  
     public static ServiceExportManager getServiceExportManager() {
 81  0
             return (ServiceExportManager) getService(KSBConstants.ServiceNames.SERVICE_EXPORT_MANAGER);
 82  
     }
 83  
 
 84  
     public static DigitalSignatureService getDigitalSignatureService() {
 85  0
         return (DigitalSignatureService) getService(KSBConstants.ServiceNames.DIGITAL_SIGNATURE_SERVICE);
 86  
     }
 87  
 
 88  
     public static JavaSecurityManagementService getJavaSecurityManagementService() {
 89  0
         return (JavaSecurityManagementService) getService(KSBConstants.ServiceNames.JAVA_SECURITY_MANAGEMENT_SERVICE);
 90  
     }
 91  
 
 92  
     public static KSBThreadPool getThreadPool() {
 93  0
         return (KSBThreadPool) getService(KSBConstants.ServiceNames.THREAD_POOL_SERVICE);
 94  
     }
 95  
 
 96  
     public static KSBScheduledPool getScheduledPool() {
 97  0
         return (KSBScheduledPool) getService(KSBConstants.ServiceNames.SCHEDULED_THREAD_POOL_SERVICE);
 98  
     }
 99  
 
 100  
     public static Bus getCXFBus(){
 101  0
             return (CXFBusImpl) getService(KSBConstants.ServiceNames.CXF_BUS);
 102  
     }
 103  
 
 104  
     public static ServletTransportFactory getCXFServletTransportFactory(){
 105  0
             return (ServletTransportFactory)getService(KSBConstants.ServiceNames.CXF_SERVLET_TRANSPORT_FACTORY);
 106  
     }
 107  
     
 108  
     public static ServerRegistry getCXFServerRegistry(){
 109  0
             return (ServerRegistry)getService(KSBConstants.ServiceNames.CXF_SERVER_REGISTRY);
 110  
     }
 111  
     
 112  
     public static List<Interceptor<? extends Message>> getInInterceptors() {
 113  
             try {
 114  0
                     return (List<Interceptor<? extends Message>>) getService(KSBConstants.ServiceNames.BUS_IN_INTERCEPTORS);
 115  
             }
 116  0
             catch(RiceRemoteServiceConnectionException ex) {
 117  
                     // swallow this exception, means no bus wide interceptors defined
 118  0
                     return null;
 119  
             }
 120  
     }
 121  
     
 122  
     public static List<Interceptor<? extends Message>> getOutInterceptors() {
 123  
             try {
 124  0
                     return (List<Interceptor<? extends Message>>) getService(KSBConstants.ServiceNames.BUS_OUT_INTERCEPTORS);
 125  
             }
 126  0
             catch(RiceRemoteServiceConnectionException ex) {
 127  
                     // swallow this exception, means no bus wide interceptors defined
 128  0
                     return null;
 129  
             }
 130  
     }
 131  
 
 132  
     public static DataSource getMessageDataSource() {
 133  0
         return (DataSource) getService(KSBConstants.ServiceNames.MESSAGE_DATASOURCE);
 134  
     }
 135  
 
 136  
     public static DataSource getMessageNonTransactionalDataSource() {
 137  0
         return (DataSource) getService(KSBConstants.ServiceNames.MESSAGE_NON_TRANSACTIONAL_DATASOURCE);
 138  
     }
 139  
 
 140  
     public static DataSource getRegistryDataSource() {
 141  0
         return (DataSource) getService(KSBConstants.ServiceNames.REGISTRY_DATASOURCE);
 142  
     }
 143  
 
 144  
     public static Scheduler getScheduler() {
 145  0
         return (Scheduler) getService(KSBConstants.ServiceNames.SCHEDULER);
 146  
     }
 147  
 
 148  
     public static BusAdminService getService() {
 149  0
         return (BusAdminService) getService(KSBConstants.ServiceNames.BUS_ADMIN_SERVICE);
 150  
     }
 151  
 
 152  
 }