Package org.ametys.core.minimize
Class SourceMapCache
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.minimize.SourceMapCache
-
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class SourceMapCache extends AbstractLogEnabled implements Component, Serviceable, Initializable
A simple cache for source maps from files
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractCacheManager
_cacheManager
CacheManager used to create and get cacheprotected SourceResolver
_sourceResolver
Excalibur source resolverstatic String
ROLE
The avalon ROLE
-
Constructor Summary
Constructors Constructor Description SourceMapCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Cache<String,Source>
_getCache()
Source
get(String uri)
Get a value from the cachevoid
initialize()
void
put(String uri, String content, Long lastModified)
Put a source map into the cachevoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_cacheManager
protected AbstractCacheManager _cacheManager
CacheManager used to create and get cache
-
_sourceResolver
protected SourceResolver _sourceResolver
Excalibur source resolver
-
-
Constructor Detail
-
SourceMapCache
public SourceMapCache()
-
-
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
-
put
public void put(String uri, String content, Long lastModified) throws IOException
Put a source map into the cache- Parameters:
uri
- The uri of the source mapcontent
- The content of the source maplastModified
- The last modified date of the source map- Throws:
IOException
- If the uri is invalid
-
get
public Source get(String uri)
Get a value from the cache- Parameters:
uri
- The uri of the source map- Returns:
- The data, or null if the uri is not in the cache
-
-