2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

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