code: @Override
      public ResolvedResource resolveResource(ResourceType type, String location)
              throws ResourceDownloadError {
          String resFolderPath = getResourceFolderPath(type);
          String encLocation = encodeLocation(location);
          String cachePath = asPath(resFolderPath, encLocation);
  
          String cacheFile = CacheLookupService.DEFAULT_RESOURCE_FILE_NAME
                  + type.getResourceExtension();
  
          String cacheLocation = asPath(cachePath, cacheFile);
  
          File resource = new File(cacheLocation);
          if (resource.exists()) {
              // cached resource exists, compare against remote hash
              HashState hashState = hashCompare(location, resource);
  
              switch (hashState) {
              case HASH_MISMATCH:
                  File newResource = downloadResourceForUse(location, type);
                  return new ResolvedResource(newResource, true);
              case HASH_MATCH:
              case MISSING_REMOTE_HASH:
              default:
                  File copiedFile = copyResource(resource, location);
                  return new ResolvedResource(copiedFile, false);
              }
          }
  
          // download the latest version because it is not in the cache
          File newResource = downloadResourceForUse(location, type);
          return new ResolvedResource(newResource, true);
      }
docs: {@inheritDoc}