source: josm/trunk/src/org/openstreetmap/josm/data/cache/ICachedLoaderJob.java@ 12867

Last change on this file since 12867 was 12453, checked in by bastiK, 7 years ago

see #14794 - remaining javadoc for the josm/data/ packages

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.cache;
3
4import java.io.IOException;
5import java.net.URL;
6
7/**
8 * Interface for a job to load a single object (typically an imagery tile).
9 * It is either retrieved from cache or downloaded from the given URL ({@link #getUrl()}).
10 *
11 * @author Wiktor Niesiobędzki
12 *
13 * @param <K> cache key type
14 */
15public interface ICachedLoaderJob<K> extends Runnable {
16 /**
17 * returns cache entry key
18 *
19 * @return cache key for tile
20 */
21 K getCacheKey();
22
23 /**
24 * method to get download URL for Job
25 * @return URL that should be fetched
26 * @throws IOException when could not determine the URL of the tile
27 *
28 */
29 URL getUrl() throws IOException;
30
31 /**
32 * fetches object from cache, or returns null when object is not found
33 *
34 * @return filled tile with data or null when no cache entry found
35 */
36 CacheEntry get();
37
38 /**
39 * Submit job for background fetch, and listener will be fed with value object
40 *
41 * @param listener cache loader listener
42 * @param force true if the load should skip all the caches (local &amp; remote)
43 * @throws IOException on failure from getUrl() call
44 */
45 void submit(ICachedLoaderListener listener, boolean force) throws IOException;
46}
Note: See TracBrowser for help on using the repository browser.