public class CacheResourcesManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CacheResourcesManager.ResourceToDeploy
Classpath resource to deploy into the lemminx cache
|
| Constructor and Description |
|---|
CacheResourcesManager() |
CacheResourcesManager(com.google.common.cache.Cache<String,CacheResourceDownloadedException> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProtocolForCache(String protocol)
Add protocol for using cache when url will start with the given protocol.
|
boolean |
canUseCache(String url)
Returns
true if cache is enabled and url comes from "http(s)" or
"ftp" and false otherwise. |
void |
evictCache()
Remove the cache directory (.lemminx/cache) if it exists.
|
void |
forceDownloadExternalResource(String url)
Force the given
url to download. |
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 |
isDownloadExternalResources()
Returns true if the external resources can be downloaded and false otherwise.
|
boolean |
isUseCache()
Returns
true if cache must be used, false
otherwise. |
void |
removeProtocolForCache(String protocol)
Remove protocol to avoid using cache when url will start with the given
protocol.
|
void |
setDownloadExternalResources(boolean downloadExternalResources)
Set true if the external resources can be downloaded and false otherwise.
|
void |
setUseCache(boolean useCache)
Set
true if cache must be used, false otherwise. |
public CacheResourcesManager()
public CacheResourcesManager(com.google.common.cache.Cache<String,CacheResourceDownloadedException> cache)
public Path getResource(String resourceURI) throws IOException
IOExceptionpublic static Path getResourceCachePath(String resourceURI) throws IOException
IOExceptionpublic static Path getResourceCachePath(URI uri) throws IOException
IOExceptionpublic 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.IOExceptionpublic 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.public boolean isDownloadExternalResources()
public void setDownloadExternalResources(boolean downloadExternalResources)
downloadExternalResources - the external resourcespublic void evictCache()
throws IOException
IOException - if the delete of directory (.lemminx/cache) cannot be
done.public void addProtocolForCache(String protocol)
protocol - the protocol to add.public void removeProtocolForCache(String protocol)
protocol - the protocol to remove.public void forceDownloadExternalResource(String url)
url to download.url - the url to download.Copyright © 2024. All rights reserved.