public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener
ICachedLoaderListener.LoadResult| Modifier and Type | Field and Description |
|---|---|
(package private) static java.util.regex.Pattern |
CDATA_PATTERN |
private static java.util.concurrent.ConcurrentMap<java.lang.String,java.util.Set<TileLoaderListener>> |
inProgress |
(package private) static java.util.regex.Pattern |
JSON_PATTERN |
static LongProperty |
MAXIMUM_EXPIRES
General maximum expires for tiles.
|
static LongProperty |
MINIMUM_EXPIRES
General minimum expires for tiles.
|
private TileJobOptions |
options |
(package private) static java.util.regex.Pattern |
SERVICE_EXCEPTION_PATTERN |
protected 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,
TileJobOptions options,
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) |
java.lang.String |
detectErrorMessage(java.lang.String data)
Tries do detect an error message from given string.
|
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)
|
java.net.URL |
getUrl()
method to get download URL for Job
|
private void |
handleError(CacheEntryAttributes attributes) |
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) |
private static java.lang.String |
removeCdata(java.lang.String msg) |
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, submitpublic static final LongProperty MAXIMUM_EXPIRES
public static final LongProperty MINIMUM_EXPIRES
static final java.util.regex.Pattern SERVICE_EXCEPTION_PATTERN
static final java.util.regex.Pattern CDATA_PATTERN
static final java.util.regex.Pattern JSON_PATTERN
private volatile java.net.URL url
private final TileJobOptions options
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, TileJobOptions options, java.util.concurrent.ThreadPoolExecutor downloadExecutor)
listener - Tile loader listenertile - to be fetched from cachecache - objectoptions - for job (such as http headers, timeouts etc.)downloadExecutor - that will be executing the jobspublic 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)private void handleError(CacheEntryAttributes attributes)
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>private boolean handleNoTileAtZoom()
private boolean isNoTileAtZoom()
private boolean tryLoadTileImage(CacheEntry object) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String detectErrorMessage(java.lang.String data)
JCSCachedTileLoaderJobdetectErrorMessage in class JCSCachedTileLoaderJob<java.lang.String,BufferedImageCacheEntry>data - string to analyzeprivate static java.lang.String removeCdata(java.lang.String msg)