public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String,BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener
ICachedLoaderListener.LoadResult| Modifier and Type | Field and Description |
|---|---|
private static ConcurrentMap<String,Set<TileLoaderListener>> |
inProgress |
private static Logger |
LOG |
private static long |
MAXIMUM_EXPIRES |
private static long |
MINIMUM_EXPIRES |
private Tile |
tile |
private 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<String,BufferedImageCacheEntry> cache,
int connectTimeout,
int readTimeout,
Map<String,String> headers,
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
|
String |
getCacheKey()
returns cache entry key
|
protected 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
|
URL |
getUrl()
method to get download URL for Job
|
private boolean |
handleNoTileAtZoom() |
private boolean |
isNoTileAtZoom() |
boolean |
isObjectLoadable() |
protected boolean |
isResponseLoadable(Map<String,List<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 long MAXIMUM_EXPIRES
private static final long MINIMUM_EXPIRES
private static final ConcurrentMap<String,Set<TileLoaderListener>> inProgress
public TMSCachedTileLoaderJob(TileLoaderListener listener, Tile tile, org.apache.commons.jcs.access.behavior.ICacheAccess<String,BufferedImageCacheEntry> cache, int connectTimeout, int readTimeout, Map<String,String> headers, 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 String getCacheKey()
ICachedLoaderJobgetCacheKey in interface ICachedLoaderJob<String>public URL getUrl() throws IOException
ICachedLoaderJobgetUrl in interface ICachedLoaderJob<String>IOException - when could not determine the URL of the tilepublic boolean isObjectLoadable()
isObjectLoadable in class JCSCachedTileLoaderJob<String,BufferedImageCacheEntry>protected boolean isResponseLoadable(Map<String,List<String>> headers, int statusCode, byte[] content)
JCSCachedTileLoaderJobisResponseLoadable in class JCSCachedTileLoaderJob<String,BufferedImageCacheEntry>headers - headers sent by serverstatusCode - http status codecontent - data read from serverprotected boolean cacheAsEmpty()
JCSCachedTileLoaderJobcacheAsEmpty in class JCSCachedTileLoaderJob<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 String getServerKey()
getServerKey in class JCSCachedTileLoaderJob<String,BufferedImageCacheEntry>protected BufferedImageCacheEntry createCacheEntry(byte[] content)
createCacheEntry in class JCSCachedTileLoaderJob<String,BufferedImageCacheEntry>public void submit()
TileJobprotected CacheEntryAttributes parseHeaders(HttpClient.Response urlConn)
parseHeaders in class JCSCachedTileLoaderJob<String,BufferedImageCacheEntry>public Tile getCachedTile()
private boolean handleNoTileAtZoom()
private boolean isNoTileAtZoom()
private boolean tryLoadTileImage(CacheEntry object) throws IOException
IOException