Coverage Report - org.kuali.rice.edl.impl.service.EdlServiceLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
EdlServiceLocator
0%
0/7
0%
0/4
1.667
 
 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.edl.impl.service;
 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  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 25  
 import org.kuali.rice.kew.api.KewApiConstants;
 26  
 
 27  0
 public class EdlServiceLocator {
 28  
         
 29  0
         private static final Logger LOG = Logger.getLogger(EdlServiceLocator.class);
 30  
 
 31  
         public static final String EDL_RUN_MODE_PROPERTY = "edl.mode";
 32  
         public static final String EDOCLITE_SERVICE = "enEDocLiteService";
 33  
         
 34  
 
 35  
     static <T> T getService(String serviceName) {
 36  0
         return GlobalResourceLoader.<T>getService(serviceName);
 37  
     }
 38  
 
 39  
         public static EDocLiteService getEDocLiteService() {
 40  0
                 return getService(EDOCLITE_SERVICE);
 41  
         }
 42  
         
 43  
         public static Object getBean(String serviceName) {
 44  0
                 if ( LOG.isDebugEnabled() ) {
 45  0
                         LOG.debug("Fetching service " + serviceName);
 46  
                 }
 47  0
                 return GlobalResourceLoader.getResourceLoader().getService(
 48  
                                 (RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(EDL_RUN_MODE_PROPERTY)))) ?
 49  
                                                 new QName(KewApiConstants.KEW_MODULE_NAMESPACE, serviceName) : new QName(serviceName));
 50  
         }
 51  
 
 52  
 }