public class CacheResourcesManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CacheResourcesManager.ResourceToDeploy |
Modifier and Type | Field and Description |
---|---|
protected com.google.common.cache.Cache<String,Boolean> |
unavailableURICache |
Constructor and Description |
---|
CacheResourcesManager() |
CacheResourcesManager(com.google.common.cache.Cache<String,Boolean> cache) |
Modifier and Type | Method and Description |
---|---|
boolean |
canUseCache(String url)
Returns
true if cache is enabled and url comes from "http(s)" or
"ftp" and false otherwise. |
Path |
getResource(String resourceURI) |
static Path |
getResourceCachePath(CacheResourcesManager.ResourceToDeploy resource)
Try to get the cached
CacheResourcesManager.ResourceToDeploy.resourceCachePath in cache
file system and if it is not found, create the file with the given content of
CacheResourcesManager.ResourceToDeploy.resourceFromClasspath stored in classpath. |
static Path |
getResourceCachePath(String resourceURI) |
static Path |
getResourceCachePath(URI uri) |
boolean |
isUseCache()
Returns
true if cache must be used, false
otherwise. |
void |
setUseCache(boolean useCache)
Set
true if cache must be used, false otherwise. |
public Path getResource(String resourceURI) throws IOException
IOException
public static Path getResourceCachePath(String resourceURI) throws IOException
IOException
public static Path getResourceCachePath(URI uri) throws IOException
IOException
public static Path getResourceCachePath(CacheResourcesManager.ResourceToDeploy resource) throws IOException
CacheResourcesManager.ResourceToDeploy.resourceCachePath
in cache
file system and if it is not found, create the file with the given content of
CacheResourcesManager.ResourceToDeploy.resourceFromClasspath
stored in classpath.resource
- the resource to deploy if needed.CacheResourcesManager.ResourceToDeploy.resourceCachePath
in cache file
system.IOException
public boolean canUseCache(String url)
true
if cache is enabled and url comes from "http(s)" or
"ftp" and false
otherwise.url
- true
if cache is enabled and url comes from "http(s)" or
"ftp" and false
otherwise.public void setUseCache(boolean useCache)
true
if cache must be used, false
otherwise.useCache
- true
if cache must be used, false
otherwise.public boolean isUseCache()
true
if cache must be used, false
otherwise.true
if cache must be used, false
otherwise.Copyright © 2020. All rights reserved.