public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener
ICachedLoaderListener.LoadResult| Modifier and Type | Field and Description |
|---|---|
private static java.util.concurrent.ConcurrentMap<java.lang.String,java.util.Set<TileLoaderListener>> |
inProgress |
private static java.util.logging.Logger |
LOG |
private static long |
MAXIMUM_EXPIRES |
private static long |
MINIMUM_EXPIRES |
private Tile |
tile |
private java.net.URL |
url |
ABSOLUTE_EXPIRE_TIME_LIMIT, attributes, cacheData, DEFAULT_EXPIRE_TIME, EXPIRE_TIME_SERVER_LIMIT, now, THREAD_LIMIT| Constructor and Description |
|---|
TMSCachedTileLoaderJob(TileLoaderListener listener,
Tile tile,
org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache,
int connectTimeout,
int readTimeout,
java.util.Map<java.lang.String,java.lang.String> headers,
java.util.concurrent.ThreadPoolExecutor downloadExecutor)
Constructor for creating a job, to get a specific tile from cache
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
cacheAsEmpty()
Simple implementation.
|
protected BufferedImageCacheEntry |
createCacheEntry(byte[] content) |
Tile |
getCachedTile()
Method for getting the tile from cache only, without trying to reach remote resource
|
java.lang.String |
getCacheKey()
returns cache entry key
|
protected java.lang.String |
getServerKey()
For TMS use BaseURL as settings discovery, so for different paths, we will have different settings (useful for developer servers)
|
Tile |
getTile()
Function to return the tile associated with the job
|
java.net.URL |
getUrl()
method to get download URL for Job
|
private boolean |
handleNoTileAtZoom() |
private boolean |
isNoTileAtZoom() |
boolean |
isObjectLoadable() |
protected boolean |
isResponseLoadable(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
int statusCode,
byte[] content)
Check if the object is loadable.
|
void |
loadingFinished(CacheEntry object,
CacheEntryAttributes attributes,
ICachedLoaderListener.LoadResult result)
Will be called when K object processed.
|
protected CacheEntryAttributes |
parseHeaders(HttpClient.Response urlConn) |
void |
submit()
submits download job to backend.
|
void |
submit(boolean force)
submits download job to backend.
|
private boolean |
tryLoadTileImage(CacheEntry object) |
cancelOutstandingTasks, executionFinished, get, handleJobCancellation, isCacheElementValid, run, setFinishedTask, submitprivate static final java.util.logging.Logger LOG
private static final long MAXIMUM_EXPIRES
private static final long MINIMUM_EXPIRES
private volatile java.net.URL url
private static final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.Set<TileLoaderListener>> inProgress
public TMSCachedTileLoaderJob(TileLoaderListener listener, Tile tile, org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache, int connectTimeout, int readTimeout, java.util.Map<java.lang.String,java.lang.String> headers, java.util.concurrent.ThreadPoolExecutor downloadExecutor)
listener - Tile loader listenertile - to be fetched from cachecache - objectconnectTimeout - when connecting to remote resourcereadTimeout - when connecting to remote resourceheaders - HTTP headers to be sent together with requestdownloadExecutor - that will be executing the jobspublic Tile getTile()
TileJobpublic java.lang.String getCacheKey()
ICachedLoaderJobgetCacheKey in interface ICachedLoaderJob<java.lang.String>public java.net.URL getUrl() throws java.io.IOException
ICachedLoaderJobgetUrl in interface ICachedLoaderJob<java.lang.String>java.io.IOException - when could not determine the URL of the tilepublic boolean isObjectLoadable()
isObjectLoadable in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>protected boolean isResponseLoadable(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, int statusCode, byte[] content)
JCSCachedTileLoaderJobisResponseLoadable in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>headers - headers sent by serverstatusCode - http status codecontent - data read from serverprotected boolean cacheAsEmpty()
JCSCachedTileLoaderJobcacheAsEmpty in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>public void submit(boolean force)
TileJobpublic void loadingFinished(CacheEntry object, CacheEntryAttributes attributes, ICachedLoaderListener.LoadResult result)
ICachedLoaderListenerloadingFinished in interface ICachedLoaderListenerobject - cache entry contentsattributes - cache entry attributesresult - load result (success, failure, canceled)protected java.lang.String getServerKey()
getServerKey in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>protected BufferedImageCacheEntry createCacheEntry(byte[] content)
createCacheEntry in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>public void submit()
TileJobprotected CacheEntryAttributes parseHeaders(HttpClient.Response urlConn)
parseHeaders in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>public Tile getCachedTile()
private boolean handleNoTileAtZoom()
private boolean isNoTileAtZoom()
private boolean tryLoadTileImage(CacheEntry object) throws java.io.IOException
java.io.IOException