Coverage Report - org.kuali.rice.krms.impl.util.KRMSServiceLocatorInternal
 
Classes in this File Line Coverage Branch Coverage Complexity
KRMSServiceLocatorInternal
0%
0/6
0%
0/4
2
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.krms.impl.util;
 17  
 
 18  
 import javax.xml.namespace.QName;
 19  
 
 20  
 import org.apache.log4j.Logger;
 21  
 import org.kuali.rice.core.api.config.module.RunMode;
 22  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 23  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 24  
 
 25  
 /**
 26  
  * This is a description of what this class does - gilesp don't forget to fill this in. 
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  *
 30  
  */
 31  0
 public class KRMSServiceLocatorInternal {
 32  
         
 33  
         public static final String KRMS_RUN_MODE_PROPERTY = "krms.mode";
 34  
         public static final String KRMS_MODULE_NAMESPACE = "KRMS";
 35  
         
 36  0
         private static final Logger LOG = Logger.getLogger(KRMSServiceLocatorInternal.class);
 37  
 
 38  
         
 39  
         @SuppressWarnings("unchecked")
 40  
         public static <A> A getService(String serviceName) {
 41  0
                 return (A)getBean(serviceName);
 42  
         }
 43  
         
 44  
         public static Object getBean(String serviceName) {
 45  0
                 if ( LOG.isDebugEnabled() ) {
 46  0
                         LOG.debug("Fetching service " + serviceName);
 47  
                 }
 48  0
                 return GlobalResourceLoader.getResourceLoader().getService(
 49  
                                 (RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KRMS_RUN_MODE_PROPERTY)))) ?
 50  
                                                 new QName(KRMS_MODULE_NAMESPACE, serviceName) : new QName(serviceName) );
 51  
         }
 52  
         
 53  
 //    public static BusinessObjectService getBusinessObjectService() {
 54  
 //            return getService(KRMS_BO_SERVICE);
 55  
 //    }
 56  
         
 57  
 }