Package org.ametys.site
Class SiteCacheHelper
- java.lang.Object
-
- org.ametys.site.SiteCacheHelper
-
public final class SiteCacheHelper extends Object
Class providing helper methods for cache files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetHashedFilePath(File file)Get a hashed file path for the given file.static StringgetHashedFilePath(File file, boolean encode)Get a hashed file path for the given file.static StringgetHashedFilePath(String filePath)Get a hashed version of the given file path.static StringgetHashedFilePath(String filePath, boolean encode)Get a hashed version of the given file path.static SourcegetHashedFileSource(SourceResolver resolver, FileSource source)Release the given file source and resolve a hashed version of the file to replace it.static FilegetRootCache()Return the root cache filestatic booleanisValid(File file)Test if a file is valid.static booleanisValid(FileSource fileSource)Test if a file source is valid.
-
-
-
Method Detail
-
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
public static Source getHashedFileSource(SourceResolver resolver, FileSource source) throws IOException, ProcessingException
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.
-
-