aQute.lib.deployer.obr
Class CachingURLResourceHandle
java.lang.Object
aQute.lib.deployer.obr.CachingURLResourceHandle
- All Implemented Interfaces:
- ResourceHandle
public class CachingURLResourceHandle
- extends Object
- implements ResourceHandle
This resource handler downloads remote resources on demand, and caches them
as local files. Resources that are already local (i.e. file:...
URLs) are returned directly.
Two alternative caching modes are available. When the mode is
CachingURLResourceHandle.CachingMode.PreferCache, the cached file will always be returned if
it exists; therefore to refresh from the remote resource it will be necessary
to delete the cache. When the mode is CachingURLResourceHandle.CachingMode.PreferRemote, the
first call to request() will always attempt to download the remote
resource, and only uses the pre-downloaded cache if the remote could not be
downloaded (e.g. because the network is offline).
- Author:
- njbartlett
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CachingURLResourceHandle
public CachingURLResourceHandle(String url,
String baseUrl,
File cacheDir,
CachingURLResourceHandle.CachingMode mode)
throws IOException
- Throws:
IOException
CachingURLResourceHandle
public CachingURLResourceHandle(String url,
String baseUrl,
File cacheDir,
URLConnector connector,
CachingURLResourceHandle.CachingMode mode)
throws IOException
- Throws:
IOException
setReporter
public void setReporter(Reporter reporter)
getName
public String getName()
- Specified by:
getName in interface ResourceHandle
getLocation
public ResourceHandle.Location getLocation()
- Specified by:
getLocation in interface ResourceHandle
request
public File request()
throws IOException
- Specified by:
request in interface ResourceHandle
- Throws:
IOException
getResolvedUrl
public URL getResolvedUrl()
Copyright © 2012 aQute SARL. All Rights Reserved.