Clover coverage report - Code Coverage for hivemind release 1.1
Coverage timestamp: Tue Oct 25 2005 10:47:07 EDT
file stats: LOC: 80   Methods: 4
NCLOC: 34   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
IdUtils.java 60% 52.9% 50% 54.8%
coverage coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.hivemind.util;
 16   
 17    import org.apache.hivemind.HiveMind;
 18   
 19    /**
 20    * A collection of utilities for handling qualified and unqualified ids.
 21    *
 22    * @author Howard Lewis Ship
 23    */
 24    public class IdUtils
 25    {
 26   
 27    /**
 28    * Returns a fully qualfied id. If the id contains a '.', then it
 29    * is returned unchanged. Otherwise, the module's id is prefixed (with a
 30    * seperator '.') and returned;
 31    */
 32  8234 public static String qualify(String moduleId, String id)
 33    {
 34  8234 if (id.indexOf('.') > 0)
 35  4550 return id;
 36   
 37  3684 return moduleId + "." + id;
 38    }
 39   
 40    /**
 41    * Qualifies a list of interceptor service ids provided for an interceptor
 42    * contribution. The special value "*" is not qualified.
 43    */
 44  65 public static String qualifyList(String sourceModuleId, String list)
 45    {
 46  65 if (HiveMind.isBlank(list) || list.equals("*"))
 47  61 return list;
 48   
 49  4 String[] items = StringUtils.split(list);
 50   
 51  4 for (int i = 0; i < items.length; i++)
 52  7 items[i] = qualify(sourceModuleId, items[i]);
 53   
 54  4 return StringUtils.join(items, ',');
 55    }
 56   
 57    /**
 58    * Removes the module name from a fully qualified id
 59    */
 60  0 public static String stripModule(String id)
 61    {
 62  0 int lastPoint = id.lastIndexOf('.');
 63  0 if (lastPoint > 0)
 64  0 return id.substring(lastPoint + 1, id.length());
 65  0 else return id;
 66    }
 67   
 68    /**
 69    * Extracts the module name from a fully qualified id
 70    * Returns null if id contains no module
 71    */
 72  0 public static String extractModule(String id)
 73    {
 74  0 int lastPoint = id.lastIndexOf('.');
 75  0 if (lastPoint > 0)
 76  0 return id.substring(0, lastPoint);
 77  0 else return null;
 78    }
 79   
 80    }