Coverage Report - org.kuali.rice.krms.impl.repository.KrmsRepositoryServiceLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
KrmsRepositoryServiceLocator
45%
5/11
25%
1/4
1.5
 
 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.repository;
 17  
 
 18  
 import org.apache.log4j.Logger;
 19  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 20  
 
 21  
 /**
 22  
  * This class keeps track of the KRMS Repository Services
 23  
  * 
 24  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 25  
  *
 26  
  */
 27  0
 public final class KrmsRepositoryServiceLocator {
 28  
 
 29  1
         private static final Logger LOG = Logger.getLogger(KrmsRepositoryServiceLocator.class);
 30  
 
 31  
     public static final String KRMS_ATTRIBUTE_DEFINITION_SERVICE = "krmsAttributeDefinitionService";
 32  
         
 33  
         private static KrmsAttributeDefinitionService krmsAttributeDefinitionService;
 34  
         
 35  
         public static <T extends Object> T getService(String serviceName) {
 36  0
                 return KrmsRepositoryServiceLocator.<T>getBean(serviceName);
 37  
         }
 38  
 
 39  
         public static <T extends Object> T getBean(String serviceName) {
 40  0
                 if ( LOG.isDebugEnabled() ) {
 41  0
                         LOG.debug("Fetching service " + serviceName);
 42  
                 }
 43  0
                 return GlobalResourceLoader.<T>getService(serviceName);
 44  
         }
 45  
 
 46  
     public static KrmsAttributeDefinitionService getKrmsAttributeDefinitionService() {
 47  6
                 if ( krmsAttributeDefinitionService == null ) {
 48  0
                         krmsAttributeDefinitionService = getService(KRMS_ATTRIBUTE_DEFINITION_SERVICE);
 49  
                 }
 50  6
                 return krmsAttributeDefinitionService;
 51  
     }
 52  
 
 53  
         public static void setKrmsAttributeDefinitionService(final KrmsAttributeDefinitionService service) {
 54  4
                 krmsAttributeDefinitionService = service;
 55  4
         }
 56  
 
 57  
 }