Ejemplo n.º 1
0
 @Override
 public String toVersionRange(String version) {
   int digits = ServiceConstants.DEFAULT_VERSION_DIGITS;
   String value =
       classPathResolver.getManifestProperty(ServiceConstants.INSTR_FAB_VERSION_RANGE_DIGITS);
   if (notEmpty(value)) {
     try {
       digits = Integer.parseInt(value);
     } catch (NumberFormatException e) {
       LOG.warn(
           "Failed to parse manifest header "
               + ServiceConstants.INSTR_FAB_VERSION_RANGE_DIGITS
               + " as a number. Got: '"
               + value
               + "' so ignoring it");
     }
     if (digits < 0 || digits > 4) {
       LOG.warn(
           "Invalid value of manifest header "
               + ServiceConstants.INSTR_FAB_VERSION_RANGE_DIGITS
               + " as value "
               + digits
               + " is out of range so ignoring it");
       digits = ServiceConstants.DEFAULT_VERSION_DIGITS;
     }
   }
   return Versions.toVersionRange(version, digits);
 }
Ejemplo n.º 2
0
    public FabClassPathResolver getClasspathResolver(
        Properties instructions, Map<String, Object> embeddedResources) {
      if (classPathResolver == null) {
        classPathResolver = new FabClassPathResolver(this, instructions, embeddedResources);

        // when used inside Fabric, the features service is not available
        if (featuresService != null) {
          classPathResolver.addPruningFilter(
              new FeaturesMatchingFilter(
                  FabResolverFactoryImpl.this.getFeaturesService(), classPathResolver));
        }
      }
      return classPathResolver;
    }