Coverage Report - org.kuali.rice.core.impl.resourceloader.SimpleServiceLocator
 
Classes in this File Line Coverage Branch Coverage Complexity
SimpleServiceLocator
0%
0/13
0%
0/4
1.5
 
 1  
 /*
 2  
  * Copyright 2006-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.core.impl.resourceloader;
 17  
 
 18  
 import java.util.HashMap;
 19  
 import java.util.Map;
 20  
 
 21  
 import javax.xml.namespace.QName;
 22  
 
 23  
 import org.kuali.rice.core.api.lifecycle.BaseLifecycle;
 24  
 import org.kuali.rice.core.api.lifecycle.BaseLifecycle;
 25  
 import org.kuali.rice.core.api.resourceloader.ServiceLocator;
 26  
 
 27  
 /**
 28  
  * A simple {@link ServiceLocator} that allows users to put services into workflow's resource loading
 29  
  * wihout creating their own {@link ServiceLocator}.
 30  
  *
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  *
 33  
  */
 34  0
 public class SimpleServiceLocator extends BaseLifecycle implements ServiceLocator {
 35  
 
 36  0
         private Map<QName, Object> services = new HashMap<QName, Object>();
 37  
 
 38  
         public String getContents(String indent, boolean servicePerLine) {
 39  0
                 String contents = indent + "SpringLoader " + this + " services =";
 40  
 
 41  0
                 for (Map.Entry<QName, Object> serviceEntry : this.services.entrySet()) {
 42  0
                         if (servicePerLine) {
 43  0
                                 contents += indent + "+++" + serviceEntry.getKey() + "=" + serviceEntry.getValue() + "\n";
 44  
                         } else {
 45  0
                                 contents += serviceEntry.getKey() + "=" + serviceEntry.getValue() + ", ";
 46  
                         }
 47  
                 }
 48  
 
 49  0
                 return contents;
 50  
         }
 51  
 
 52  
         public Object getService(QName qname) {
 53  0
                 return this.services.get(qname);
 54  
         }
 55  
 
 56  
         public void addService(QName name, Object service) {
 57  0
             this.services.put(name, service);
 58  0
         }
 59  
 
 60  
         public void removeService(QName name) {
 61  0
             this.services.remove(name);
 62  0
         }
 63  
 }