Class SiteCacheHelper

java.lang.Object
org.ametys.site.SiteCacheHelper

public final class SiteCacheHelper extends Object
Class providing helper methods for cache files.
  • Method Details

    • getRootCache

      public static File getRootCache()
      Return the root cache file
      Returns:
      The root cache File
    • isValid

      public static boolean isValid(File file)
      Test if a file is valid.
      Parameters:
      file - the file to test.
      Returns:
      true if the file is valid, false otherwise.
    • isValid

      public static boolean isValid(FileSource fileSource)
      Test if a file source is valid.
      Parameters:
      fileSource - the file source to test.
      Returns:
      true if the file is valid, false otherwise.
    • getHashedFilePath

      public static String getHashedFilePath(File file)
      Get a hashed file path for the given file.
      Parameters:
      file - the original resource file.
      Returns:
      the hashed file path.
    • getHashedFilePath

      public static String getHashedFilePath(File file, boolean encode)
      Get a hashed file path for the given file.
      Parameters:
      file - the original resource file.
      encode - true to encode the folder parts, false otherwise.
      Returns:
      the hashed file path.
    • getHashedFilePath

      public static String getHashedFilePath(String filePath)
      Get a hashed version of the given file path.
      Parameters:
      filePath - the original file path.
      Returns:
      the hashed file path.
    • getHashedFilePath

      public static String getHashedFilePath(String filePath, boolean encode)
      Get a hashed version of the given file path.
      Parameters:
      filePath - the original file path.
      encode - true to encode the folder parts, false otherwise.
      Returns:
      the hashed file path.
    • getHashedFileSource

      Release the given file source and resolve a hashed version of the file to replace it.
      Parameters:
      resolver - the source resolver.
      source - the invalid file source to hash.
      Returns:
      the hashed file source.
      Throws:
      IOException - if an IO error occurs.
      ProcessingException - if the new source couldn't be resolved.