Clover coverage report - Code Coverage for hivemind release 1.0-rc-2
Coverage timestamp: Sat Sep 11 2004 09:09:48 EDT
file stats: LOC: 367   Methods: 45
NCLOC: 290   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ImplMessages.java 100% 65.5% 57.8% 63.5%
coverage coverage
 1   
 //  Copyright 2004 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.impl;
 16   
 
 17   
 import java.net.URL;
 18   
 import java.util.Collection;
 19   
 import java.util.Iterator;
 20   
 
 21   
 import org.apache.hivemind.ClassResolver;
 22   
 import org.apache.hivemind.Element;
 23   
 import org.apache.hivemind.HiveMind;
 24   
 import org.apache.hivemind.Location;
 25   
 import org.apache.hivemind.Occurances;
 26   
 import org.apache.hivemind.Resource;
 27   
 import org.apache.hivemind.events.RegistryShutdownListener;
 28   
 import org.apache.hivemind.internal.ConfigurationPoint;
 29   
 import org.apache.hivemind.internal.Module;
 30   
 import org.apache.hivemind.internal.ServiceInterceptorContribution;
 31   
 import org.apache.hivemind.internal.ServicePoint;
 32   
 import org.apache.hivemind.parse.ContributionDescriptor;
 33   
 import org.apache.hivemind.parse.ModuleDescriptor;
 34   
 import org.apache.hivemind.schema.Schema;
 35   
 import org.apache.hivemind.schema.SchemaProcessor;
 36   
 
 37   
 /**
 38   
  * Used to format messages used in errors and log output for classes within the
 39   
  * impl package.
 40   
  *
 41   
  * @author Howard Lewis Ship
 42   
  */
 43   
 final class ImplMessages
 44   
 {
 45   
     private static final MessageFormatter _formatter =
 46   
         new MessageFormatter(ImplMessages.class, "ImplStrings");
 47   
 
 48  1
     public static String recursiveServiceBuild(ServicePoint point)
 49   
     {
 50  1
         return _formatter.format("recursive-service-build", point.getExtensionPointId());
 51   
     }
 52   
 
 53  0
     public static String recursiveConfiguration(String pointId)
 54   
     {
 55  0
         return _formatter.format("recursive-configuration", pointId);
 56   
     }
 57   
 
 58  3
     public static String unableToConstructConfiguration(String pointId, Throwable exception)
 59   
     {
 60  3
         return _formatter.format(
 61   
             "unable-to-construct-configuration",
 62   
             pointId,
 63   
             exception.getMessage());
 64   
     }
 65   
 
 66  0
     public static String unknownServiceModel(String name)
 67   
     {
 68  0
         return _formatter.format("unknown-service-model", name);
 69   
     }
 70   
 
 71  0
     public static String dupeServiceModelName(String name, Location oldLocation)
 72   
     {
 73  0
         return _formatter.format("dupe-service-model-name", name, oldLocation);
 74   
     }
 75   
 
 76  1
     public static String unknownTranslatorName(String name, String configurationId)
 77   
     {
 78  1
         return _formatter.format("unknown-translator-name", name, configurationId);
 79   
     }
 80   
 
 81  0
     public static String duplicateTranslatorName(String name, Location oldLocation)
 82   
     {
 83  0
         return _formatter.format(
 84   
             "duplicate-translator-name",
 85   
             name,
 86   
             HiveMind.getLocationString(oldLocation));
 87   
     }
 88   
 
 89  0
     public static String translatorInstantiationFailure(Class translatorClass, Throwable cause)
 90   
     {
 91  0
         return _formatter.format(
 92   
             "translator-instantiation-failure",
 93   
             translatorClass.getName(),
 94   
             cause);
 95   
     }
 96   
 
 97  0
     public static String noSuchServicePoint(String serviceId)
 98   
     {
 99  0
         return _formatter.format("no-such-service-point", serviceId);
 100   
     }
 101   
 
 102  3
     public static String unableToLoadClass(String name, ClassLoader loader, Throwable cause)
 103   
     {
 104  3
         return _formatter.format("unable-to-load-class", name, loader, cause);
 105   
     }
 106   
 
 107  0
     public static String nullInterceptor(
 108   
         ServiceInterceptorContribution contribution,
 109   
         ServicePoint point)
 110   
     {
 111  0
         return _formatter.format(
 112   
             "null-interceptor",
 113   
             contribution.getFactoryServiceId(),
 114   
             point.getExtensionPointId());
 115   
     }
 116   
 
 117  0
     public static String interceptorDoesNotImplementInterface(
 118   
         Object interceptor,
 119   
         ServiceInterceptorContribution contribution,
 120   
         ServicePoint point,
 121   
         Class serviceInterface)
 122   
     {
 123  0
         return _formatter.format(
 124   
             "interceptor-does-not-implement-interface",
 125   
             new Object[] {
 126   
                 interceptor,
 127   
                 contribution.getFactoryServiceId(),
 128   
                 point.getExtensionPointId(),
 129   
                 serviceInterface.getName()});
 130   
     }
 131   
 
 132  0
     public static String unabelToReadMessages(URL url)
 133   
     {
 134  0
         return _formatter.format("unable-to-read-messages", url);
 135   
     }
 136   
 
 137  1
     public static String duplicateSchema(String schemaId, Schema existingSchema)
 138   
     {
 139  1
         return _formatter.format("duplicate-schema", schemaId, existingSchema.getLocation());
 140   
     }
 141   
 
 142  0
     public static String unableToParse(Resource resource, Throwable cause)
 143   
     {
 144  0
         return _formatter.format("unable-to-parse", resource, cause);
 145   
     }
 146   
 
 147  0
     public static String unableToFindModules(ClassResolver resolver, Throwable cause)
 148   
     {
 149  0
         return _formatter.format("unable-to-find-modules", resolver, cause);
 150   
     }
 151   
 
 152  0
     public static String duplicateModuleId(Module existingModule, ModuleDescriptor descriptor)
 153   
     {
 154  0
         return _formatter.format(
 155   
             "duplicate-module-id",
 156   
             existingModule.getModuleId(),
 157   
             existingModule.getLocation().getResource(),
 158   
             descriptor.getLocation().getResource());
 159   
     }
 160   
 
 161  1
     public static String unknownConfigurationPoint(
 162   
         String moduleId,
 163   
         ContributionDescriptor descriptor)
 164   
     {
 165  1
         return _formatter.format(
 166   
             "unknown-configuration-extension-point",
 167   
             moduleId,
 168   
             descriptor.getConfigurationId());
 169   
     }
 170   
 
 171  0
     public static String unknownServicePoint(Module sourceModule, String pointId)
 172   
     {
 173  0
         return _formatter.format(
 174   
             "unknown-service-extension-point",
 175   
             sourceModule.getModuleId(),
 176   
             pointId);
 177   
     }
 178   
 
 179  0
     public static String missingService(ServicePoint point)
 180   
     {
 181  0
         return _formatter.format("missing-service", point.getExtensionPointId());
 182   
     }
 183   
 
 184  0
     public static String duplicateFactory(
 185   
         Module sourceModule,
 186   
         String pointId,
 187   
         ServicePointImpl existing)
 188   
     {
 189  0
         return _formatter.format(
 190   
             "duplicate-factory",
 191   
             sourceModule.getModuleId(),
 192   
             pointId,
 193   
             existing.getServiceConstructor().getContributingModule().getModuleId());
 194   
     }
 195   
 
 196  2
     public static String wrongNumberOfContributions(
 197   
         ConfigurationPoint point,
 198   
         int actualCount,
 199   
         Occurances expectation)
 200   
     {
 201  2
         return _formatter.format(
 202   
             "wrong-number-of-contributions",
 203   
             point.getExtensionPointId(),
 204   
             contributionCount(actualCount),
 205   
             occurances(expectation));
 206   
     }
 207   
 
 208  4
     public static String occurances(Occurances occurances)
 209   
     {
 210  4
         return _formatter.getMessage("occurances." + occurances.getName());
 211   
     }
 212   
 
 213  4
     public static String contributionCount(int count)
 214   
     {
 215  4
         return _formatter.format("contribution-count", new Integer(count));
 216   
     }
 217   
 
 218  2
     public static String wrongNumberOfParameters(
 219   
         String factoryServiceId,
 220   
         int actualCount,
 221   
         Occurances expectation)
 222   
     {
 223  2
         return _formatter.format(
 224   
             "wrong-number-of-parameters",
 225   
             factoryServiceId,
 226   
             contributionCount(actualCount),
 227   
             occurances(expectation));
 228   
 
 229   
     }
 230   
 
 231  1
     public static String noSuchConfiguration(String pointId)
 232   
     {
 233  1
         return _formatter.format("no-such-configuration", pointId);
 234   
     }
 235   
 
 236  3
     public static String noSuchSymbol(String name)
 237   
     {
 238  3
         return _formatter.format("no-such-symbol", name);
 239   
     }
 240   
 
 241  3
     public static String symbolSourceContribution()
 242   
     {
 243  3
         return _formatter.getMessage("symbol-source-contribution");
 244   
     }
 245   
 
 246  1
     public static String unknownAttribute(String name)
 247   
     {
 248  1
         return _formatter.format("unknown-attribute", name);
 249   
     }
 250   
 
 251  1
     public static String missingAttribute(String name)
 252   
     {
 253  1
         return _formatter.format("missing-attribute", name);
 254   
     }
 255   
 
 256  1
     public static String uniqueAttributeConstraintBroken(
 257   
         String name,
 258   
         String value,
 259   
         Location priorLocation)
 260   
     {
 261  1
         return _formatter.format("unique-attribute-constraint-broken", name, value, priorLocation);
 262   
     }
 263   
 
 264  2
     public static String elementErrors(SchemaProcessor processor, Element element)
 265   
     {
 266  2
         return _formatter.format(
 267   
             "element-errors",
 268   
             processor.getElementPath(),
 269   
             element.getLocation());
 270   
     }
 271   
 
 272  1
     public static String unknownElement(SchemaProcessor processor, Element element)
 273   
     {
 274  1
         return _formatter.format("unknown-element", processor.getElementPath());
 275   
     }
 276   
 
 277  0
     public static String badInterface(String interfaceName, String pointId)
 278   
     {
 279  0
         return _formatter.format("bad-interface", interfaceName, pointId);
 280   
     }
 281   
 
 282  0
     public static String interfaceRequired(String interfaceName, String pointId)
 283   
     {
 284  0
         return _formatter.format("interface-required", interfaceName, pointId);
 285   
     }
 286   
 
 287  0
     public static String serviceWrongInterface(ServicePoint servicePoint, Class requestedInterface)
 288   
     {
 289  0
         return _formatter.format(
 290   
             "service-wrong-interface",
 291   
             servicePoint.getExtensionPointId(),
 292   
             requestedInterface.getName(),
 293   
             servicePoint.getServiceInterface().getName());
 294   
     }
 295   
 
 296  1
     public static String shutdownCoordinatorFailure(
 297   
         RegistryShutdownListener listener,
 298   
         Throwable cause)
 299   
     {
 300  1
         return _formatter.format("shutdown-coordinator-failure", listener, cause);
 301   
     }
 302   
 
 303  5
     public static String unlocatedError(String message)
 304   
     {
 305  5
         return _formatter.format("unlocated-error", message);
 306   
     }
 307   
 
 308  25
     public static String locatedError(Location location, String message)
 309   
     {
 310  25
         return _formatter.format("located-error", location, message);
 311   
     }
 312   
 
 313  16
     public static String interceptorContribution()
 314   
     {
 315  16
         return _formatter.getMessage("interceptor-contribution");
 316   
     }
 317   
 
 318  0
     public static String registryAlreadyStarted()
 319   
     {
 320  0
         return _formatter.getMessage("registry-already-started");
 321   
     }
 322   
 
 323  1
     public static String noServicePointForInterface(Class interfaceClass)
 324   
     {
 325  1
         return _formatter.format("no-service-point-for-interface", interfaceClass.getName());
 326   
     }
 327   
 
 328  1
     public static String multipleServicePointsForInterface(
 329   
         Class interfaceClass,
 330   
         Collection matchingPoints)
 331   
     {
 332  1
         StringBuffer buffer = new StringBuffer("{");
 333   
 
 334  1
         boolean following = false;
 335   
 
 336  1
         Iterator i = matchingPoints.iterator();
 337  1
         while (i.hasNext())
 338   
         {
 339  2
             if (following)
 340  1
                 buffer.append(", ");
 341   
 
 342  2
             ServicePoint p = (ServicePoint) i.next();
 343   
 
 344  2
             buffer.append(p.getExtensionPointId());
 345   
 
 346  2
             following = true;
 347   
         }
 348   
 
 349  1
         buffer.append("}");
 350   
 
 351  1
         return _formatter.format(
 352   
             "multiple-service-points-for-interface",
 353   
             interfaceClass.getName(),
 354   
             buffer);
 355   
     }
 356   
 
 357  1
     public static String incompleteTranslator(TranslatorContribution c)
 358   
     {
 359  1
         return _formatter.format("incomplete-translator", c.getName());
 360   
     }
 361   
 
 362  2
     public static String schemaStackViolation(SchemaProcessor processor)
 363   
     {
 364  2
         return _formatter.format("schema-stack-violation", processor.getElementPath());
 365   
     }
 366   
 }
 367