Class HashCache
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.ui.minimize.HashCache
-
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class HashCache extends AbstractLogEnabled implements Component, Serviceable, Initializable
The cache for hashed list of files to minimize
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HashCache.UriData
The description of an URI
-
Field Summary
Fields Modifier and Type Field Description protected AbstractCacheManager
_cacheManager
CacheManager used to create and get cacheprotected RequestAttributesHelper
_requestAttributesHelper
RequestAttributesHelperprotected ResourceDependenciesListExtensionPoint
_resourceDependenciesListEP
ResourceDependenciesListExtensionPointstatic String
ROLE
The avalon ROLE
-
Constructor Summary
Constructors Constructor Description HashCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Cache<String,List<HashCache.UriData>>
_getCache()
String
createHash(Map<String,Map<String,String>> files, String salt)
Creates and memorize a hash code corresponding to a list of filesList<HashCache.UriData>
getFilesForHash(String hash, boolean firstLevel)
Get the file list corresponding to the given hashcodevoid
initialize()
void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_requestAttributesHelper
protected RequestAttributesHelper _requestAttributesHelper
RequestAttributesHelper
-
_resourceDependenciesListEP
protected ResourceDependenciesListExtensionPoint _resourceDependenciesListEP
ResourceDependenciesListExtensionPoint
-
_cacheManager
protected AbstractCacheManager _cacheManager
CacheManager used to create and get cache
-
-
Constructor Detail
-
HashCache
public HashCache()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getFilesForHash
public List<HashCache.UriData> getFilesForHash(String hash, boolean firstLevel)
Get the file list corresponding to the given hashcode- Parameters:
hash
- The hashcode created by createHash in this sessionfirstLevel
- File imported by other files will not be included- Returns:
- The list of files or null if the hashcode does not exists
-
createHash
public String createHash(Map<String,Map<String,String>> files, String salt) throws IllegalArgumentException
Creates and memorize a hash code corresponding to a list of files- Parameters:
files
- The files. Key is the file uri and the value is a map with two keys 'media' and 'tag'.salt
- Additional parameter used as salt for the hash key.- Returns:
- The hash code
- Throws:
IllegalArgumentException
- If an error occurred
-
_getCache
private Cache<String,List<HashCache.UriData>> _getCache()
-
-