/**
   * @param logging
   * @param origin origin source
   * @param ident unique identity for this cached source, used in filename
   * @param descr description of the source, used in logging
   * @param logging if true, log cache access
   * @return new source
   */
  public ResourceModelSource createCachingSource(
      ResourceModelSource origin,
      String ident,
      String descr,
      SourceFactory.CacheType type,
      final boolean logging) {
    final File file = getResourceModelSourceFileCacheForType(ident);
    final ResourceModelSourceService nodesSourceService = getResourceModelSourceService();
    final ResourceFormatGeneratorService resourceFormatGeneratorService =
        getResourceFormatGeneratorService();
    final Properties fileSourceConfig =
        generateFileSourceConfigurationProperties(
            file.getAbsolutePath(), ResourceXMLFormatGenerator.SERVICE_PROVIDER_TYPE, false, false);
    try {
      ResourceModelSource fileSource =
          nodesSourceService.getSourceForConfiguration("file", fileSourceConfig);

      ResourceFormatGenerator generatorForFormat =
          resourceFormatGeneratorService.getGeneratorForFormat(
              ResourceXMLFormatGenerator.SERVICE_PROVIDER_TYPE);

      String ident1 =
          "[ResourceModelSource: " + descr + ", project: " + projectConfig.getName() + "]";
      StoreExceptionHandler handler = new StoreExceptionHandler(ident);
      ResourceModelSourceCache cache =
          new FileResourceModelSourceCache(file, generatorForFormat, fileSource);
      if (logging) {
        cache = new LoggingResourceModelSourceCache(cache, ident1);
      }
      return SourceFactory.cachedSource(origin, ident1, handler, cache, type);
    } catch (UnsupportedFormatException | ExecutionServiceException e) {
      e.printStackTrace();
    }
    return null;
  }
  private ResourceModelSource loadResourceModelSource(
      String type, Properties configuration, boolean useCache, String ident)
      throws ExecutionServiceException {

    final ResourceModelSourceService nodesSourceService = getResourceModelSourceService();
    configuration.put("project", projectConfig.getName());
    ResourceModelSource sourceForConfiguration =
        nodesSourceService.getSourceForConfiguration(type, configuration);

    if (useCache) {
      ResourceModelSourceFactory provider = nodesSourceService.providerOfType(type);
      String name = ident;
      if (provider instanceof Describable) {
        Describable desc = (Describable) provider;
        Description description = desc.getDescription();
        name = ident + " (" + description.getTitle() + ")";
      }
      return createCachingSource(sourceForConfiguration, ident, name);
    } else {
      return sourceForConfiguration;
    }
  }