Clover coverage report - Code Coverage for hivemind release 1.0-beta-1
Coverage timestamp: Sat Jul 3 2004 09:41:37 EDT
file stats: LOC: 298   Methods: 37
NCLOC: 235   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 75% 50% 45.9% 49.4%
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   
 
 19   
 import org.apache.hivemind.ClassResolver;
 20   
 import org.apache.hivemind.Element;
 21   
 import org.apache.hivemind.HiveMind;
 22   
 import org.apache.hivemind.Location;
 23   
 import org.apache.hivemind.Occurances;
 24   
 import org.apache.hivemind.Resource;
 25   
 import org.apache.hivemind.events.RegistryShutdownListener;
 26   
 import org.apache.hivemind.internal.ConfigurationPoint;
 27   
 import org.apache.hivemind.internal.Module;
 28   
 import org.apache.hivemind.internal.ServiceInterceptorContribution;
 29   
 import org.apache.hivemind.internal.ServicePoint;
 30   
 import org.apache.hivemind.parse.ContributionDescriptor;
 31   
 import org.apache.hivemind.parse.ModuleDescriptor;
 32   
 import org.apache.hivemind.schema.Schema;
 33   
 import org.apache.hivemind.schema.SchemaProcessor;
 34   
 
 35   
 /**
 36   
  * Used to format messages used in errors and log output for classes within the
 37   
  * impl package.
 38   
  *
 39   
  * @author Howard Lewis Ship
 40   
  */
 41   
 final class ImplMessages
 42   
 {
 43   
     private static final MessageFormatter _formatter =
 44   
         new MessageFormatter(ImplMessages.class, "ImplStrings");
 45   
 
 46  1
     public static String recursiveServiceBuild(ServicePoint point)
 47   
     {
 48  1
         return _formatter.format("recursive-service-build", point.getExtensionPointId());
 49   
     }
 50   
 
 51  0
     public static String recursiveConfiguration(String pointId)
 52   
     {
 53  0
         return _formatter.format("recursive-configuration", pointId);
 54   
     }
 55   
 
 56  2
     public static String unableToConstructConfiguration(String pointId, Throwable exception)
 57   
     {
 58  2
         return _formatter.format(
 59   
             "unable-to-construct-configuration",
 60   
             pointId,
 61   
             exception.getMessage());
 62   
     }
 63   
 
 64  0
     public static String unknownServiceModel(String name)
 65   
     {
 66  0
         return _formatter.format("unknown-service-model", name);
 67   
     }
 68   
 
 69  0
     public static String dupeServiceModelName(String name, Location oldLocation)
 70   
     {
 71  0
         return _formatter.format("dupe-service-model-name", name, oldLocation);
 72   
     }
 73   
 
 74  0
     public static String unknownTranslatorName(String name, String configurationId)
 75   
     {
 76  0
         return _formatter.format("unknown-translator-name", name, configurationId);
 77   
     }
 78   
 
 79  0
     public static String duplicateTranslatorName(String name, Location oldLocation)
 80   
     {
 81  0
         return _formatter.format(
 82   
             "duplicate-translator-name",
 83   
             name,
 84   
             HiveMind.getLocationString(oldLocation));
 85   
     }
 86   
 
 87  0
     public static String translatorInstantiationFailure(Class translatorClass, Throwable cause)
 88   
     {
 89  0
         return _formatter.format(
 90   
             "translator-instantiation-failure",
 91   
             translatorClass.getName(),
 92   
             cause);
 93   
     }
 94   
 
 95  0
     public static String noSuchServicePoint(String serviceId)
 96   
     {
 97  0
         return _formatter.format("no-such-service-point", serviceId);
 98   
     }
 99   
 
 100  3
     public static String unableToLoadClass(String name, ClassLoader loader, Throwable cause)
 101   
     {
 102  3
         return _formatter.format("unable-to-load-class", name, loader, cause);
 103   
     }
 104   
 
 105  0
     public static String nullInterceptor(
 106   
         ServiceInterceptorContribution contribution,
 107   
         ServicePoint point)
 108   
     {
 109  0
         return _formatter.format(
 110   
             "null-interceptor",
 111   
             contribution.getFactoryServiceId(),
 112   
             point.getExtensionPointId());
 113   
     }
 114   
 
 115  0
     public static String interceptorDoesNotImplementInterface(
 116   
         Object interceptor,
 117   
         ServiceInterceptorContribution contribution,
 118   
         ServicePoint point,
 119   
         Class serviceInterface)
 120   
     {
 121  0
         return _formatter.format(
 122   
             "interceptor-does-not-implement-interface",
 123   
             new Object[] {
 124   
                 interceptor,
 125   
                 contribution.getFactoryServiceId(),
 126   
                 point.getExtensionPointId(),
 127   
                 serviceInterface.getName()});
 128   
     }
 129   
 
 130  0
     public static String unabelToReadMessages(URL url)
 131   
     {
 132  0
         return _formatter.format("unable-to-read-messages", url);
 133   
     }
 134   
 
 135  1
     public static String duplicateSchema(String schemaId, Schema existingSchema)
 136   
     {
 137  1
         return _formatter.format("duplicate-schema", schemaId, existingSchema.getLocation());
 138   
     }
 139   
 
 140  0
     public static String unableToParse(Resource resource, Throwable cause)
 141   
     {
 142  0
         return _formatter.format("unable-to-parse", resource, cause);
 143   
     }
 144   
 
 145  0
     public static String unableToFindModules(ClassResolver resolver, Throwable cause)
 146   
     {
 147  0
         return _formatter.format("unable-to-find-modules", resolver, cause);
 148   
     }
 149   
 
 150  0
     public static String duplicateModuleId(Module existingModule, ModuleDescriptor descriptor)
 151   
     {
 152  0
         return _formatter.format(
 153   
             "duplicate-module-id",
 154   
             existingModule.getModuleId(),
 155   
             existingModule.getLocation().getResource(),
 156   
             descriptor.getLocation().getResource());
 157   
     }
 158   
 
 159  1
     public static String unknownConfigurationPoint(
 160   
         String moduleId,
 161   
         ContributionDescriptor descriptor)
 162   
     {
 163  1
         return _formatter.format(
 164   
             "unknown-configuration-extension-point",
 165   
             moduleId,
 166   
             descriptor.getConfigurationId());
 167   
     }
 168   
 
 169  0
     public static String unknownServicePoint(Module sourceModule, String pointId)
 170   
     {
 171  0
         return _formatter.format(
 172   
             "unknown-service-extension-point",
 173   
             sourceModule.getModuleId(),
 174   
             pointId);
 175   
     }
 176   
 
 177  0
     public static String missingService(ServicePoint point)
 178   
     {
 179  0
         return _formatter.format("missing-service", point.getExtensionPointId());
 180   
     }
 181   
 
 182  0
     public static String duplicateFactory(
 183   
         Module sourceModule,
 184   
         String pointId,
 185   
         ServicePointImpl existing)
 186   
     {
 187  0
         return _formatter.format(
 188   
             "duplicate-factory",
 189   
             sourceModule.getModuleId(),
 190   
             pointId,
 191   
             existing.getServiceConstructor().getContributingModule().getModuleId());
 192   
     }
 193   
 
 194  2
     public static String wrongNumberOfContributions(
 195   
         ConfigurationPoint point,
 196   
         int actualCount,
 197   
         Occurances expectation)
 198   
     {
 199  2
         String key = "optional";
 200   
 
 201  2
         if (expectation == Occurances.REQUIRED)
 202  0
             key = "required";
 203   
         else
 204  2
             if (expectation == Occurances.ONE_PLUS)
 205  1
                 key = "one-or-more";
 206   
 
 207  2
         return _formatter.format(
 208   
             "wrong-number-of-contributions",
 209   
             point.getExtensionPointId(),
 210   
             new Integer(actualCount),
 211   
             _formatter.getMessage(key));
 212   
     }
 213   
 
 214  1
     public static String noSuchConfiguration(String pointId)
 215   
     {
 216  1
         return _formatter.format("no-such-configuration", pointId);
 217   
     }
 218   
 
 219  1
     public static String noSuchSymbol(String name)
 220   
     {
 221  1
         return _formatter.format("no-such-symbol", name);
 222   
     }
 223   
 
 224  3
     public static String symbolSourceContribution()
 225   
     {
 226  3
         return _formatter.getMessage("symbol-source-contribution");
 227   
     }
 228   
 
 229  1
     public static String unknownAttribute(String name)
 230   
     {
 231  1
         return _formatter.format("unknown-attribute", name);
 232   
     }
 233   
 
 234  1
     public static String missingAttribute(String name)
 235   
     {
 236  1
         return _formatter.format("missing-attribute", name);
 237   
     }
 238   
 
 239  1
     public static String elementErrors(SchemaProcessor processor, Element element)
 240   
     {
 241  1
         return _formatter.format(
 242   
             "element-errors",
 243   
             processor.getElementPath(),
 244   
             element.getLocation());
 245   
     }
 246   
 
 247  1
     public static String unknownElement(SchemaProcessor processor, Element element)
 248   
     {
 249  1
         return _formatter.format("unknown-element", processor.getElementPath());
 250   
     }
 251   
 
 252  0
     public static String badInterface(String interfaceName, String pointId)
 253   
     {
 254  0
         return _formatter.format("bad-interface", interfaceName, pointId);
 255   
     }
 256   
 
 257  0
     public static String interfaceRequired(String interfaceName, String pointId)
 258   
     {
 259  0
         return _formatter.format("interface-required", interfaceName, pointId);
 260   
     }
 261   
 
 262  0
     public static String serviceWrongInterface(ServicePoint servicePoint, Class requestedInterface)
 263   
     {
 264  0
         return _formatter.format(
 265   
             "service-wrong-interface",
 266   
             servicePoint.getExtensionPointId(),
 267   
             requestedInterface.getName(),
 268   
             servicePoint.getServiceInterface().getName());
 269   
     }
 270   
 
 271  1
     public static String shutdownCoordinatorFailure(
 272   
         RegistryShutdownListener listener,
 273   
         Throwable cause)
 274   
     {
 275  1
         return _formatter.format("shutdown-coordinator-failure", listener, cause);
 276   
     }
 277   
 
 278  4
     public static String unlocatedError(String message)
 279   
     {
 280  4
         return _formatter.format("unlocated-error", message);
 281   
     }
 282   
 
 283  23
     public static String locatedError(Location location, String message)
 284   
     {
 285  23
         return _formatter.format("located-error", location, message);
 286   
     }
 287   
 
 288  13
     public static String interceptorContribution()
 289   
     {
 290  13
         return _formatter.getMessage("interceptor-contribution");
 291   
     }
 292   
 
 293  0
     public static String registryAlreadyStarted()
 294   
     {
 295  0
         return _formatter.getMessage("registry-already-started");
 296   
     }
 297   
 }
 298