Changeset 370

Show
Ignore:
Timestamp:
09/02/08 22:50:21 (4 months ago)
Author:
arneke
Message:

(Re)added functionality to force reseeding of existing tiles. Renamed getResponse to getTile.

Location:
trunk/geowebcache/src/main/java/org/geowebcache
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/geowebcache/src/main/java/org/geowebcache/GeoWebCacheDispatcher.java

    r346 r370  
    257257            //tile.requestURI = request.getRequestURI(); 
    258258             
    259             // A5) Ask the layer to provide the tile 
    260             layer.getResponse(tile); 
     259            // A5) Ask the layer to provide the content for the tile 
     260            layer.getTile(tile); 
    261261 
    262262            // A6) Write response 
  • trunk/geowebcache/src/main/java/org/geowebcache/layer/TileLayer.java

    r348 r370  
    179179     * @throws IOException 
    180180     */ 
    181     public abstract Tile getResponse(Tile tile) throws GeoWebCacheException, 
    182             IOException; 
    183  
     181    public abstract Tile getTile(Tile tile)  
     182    throws GeoWebCacheException, IOException; 
     183 
     184    public abstract void seedTile(Tile tile, boolean tryCache)  
     185    throws GeoWebCacheException, IOException; 
     186     
    184187    /** 
    185188     * This is a more direct way of requesting a tile without invoking 
  • trunk/geowebcache/src/main/java/org/geowebcache/layer/wms/WMSLayer.java

    r348 r370  
    6767    private String errormime; 
    6868 
    69     //private int width; 
    70  
    71     //private int height; 
    72  
    7369    private String version; 
    7470 
     
    8581    private String vendorParameters; 
    8682 
    87     //private boolean debugheaders; 
    88  
    89     //protected transient GridCalculator[] gridCalc; 
    90  
    91     //private transient int zoomStart; 
    92  
    93     //private transient int zoomStop; 
    94  
    95     //private transient String request; 
    96  
    97     //protected transient String[] wmsURL; 
    98  
    9983    private transient int curWmsURL; 
    10084 
    101     //private transient String wmsLayers; 
    102  
    103     //private transient String wmsStyles; 
    104  
    105     //private transient WMSParameters wmsparams; 
    106  
    10785    private transient boolean saveExpirationHeaders; 
    10886 
     
    134112 
    135113    private static transient Log log; 
    136  
    137     //public WMSLayer(String layerName, CacheFactory cacheFactory) 
    138     //        throws GeoWebCacheException { 
    139     //    name = layerName; 
    140     //    initCacheFactory = cacheFactory; 
    141     //    log = LogFactory.getLog(org.geowebcache.layer.wms.WMSLayer.class); 
    142     //} 
    143114     
    144115    public WMSLayer(String layerName, CacheFactory cacheFactory, 
     
    167138        //log = LogFactory.getLog(org.geowebcache.layer.wms.WMSLayer.class); 
    168139    } 
    169      
    170 //    private void lazyLayerInitialization() { 
    171 //        width = 256; 
    172 //        height = 256; 
    173 //        version = "1.1.0"; 
    174 //        transparent = true; 
    175 //        zoomStart = 0; 
    176 //        zoomStop = 20; 
    177 //        request = "GetMap"; 
    178 //        errormime = ErrorMime.vnd_ogc_se_inimage.getMimeType(); 
    179 //        curWmsURL = 0; 
    180 //        wmsLayers = "topp:states"; 
    181 //        saveExpirationHeaders = false; 
    182 //        expireClients = GWCVars.CACHE_USE_WMS_BACKEND_VALUE; 
    183 //        expireCache = GWCVars.CACHE_NEVER_EXPIRE; 
    184 //        layerLock = new ReentrantLock(); 
    185 //        layerLocked = false; 
    186 //        layerLockedCond = layerLock.newCondition(); 
    187 //        procQueue = new HashMap<GridLocObj, Boolean>(); 
    188 //        cacheLockWait = -1; 
    189 //        //initCacheFactory = cf;             
    190 //    } 
    191140 
    192141    public Boolean isInitialized() { 
     
    204153 
    205154    protected Boolean initialize() { 
    206          
    207         //lazyLayerInitialization(); 
    208155        log = LogFactory.getLog(org.geowebcache.layer.wms.WMSLayer.class); 
    209156        curWmsURL = 0; 
     
    214161        //width = 256; 
    215162        //height = 256; 
    216          
    217163        //request = "GetMap"; 
     164         
    218165        errormime = ErrorMime.vnd_ogc_se_inimage.getMimeType(); 
    219166        version = "1.1.0"; 
     
    226173        procQueue = new HashMap<GridLocObj, Boolean>(); 
    227174         
    228          
    229175        try { 
    230176            initParameters(); 
     
    258204     * @return 
    259205     */ 
    260     public Tile getResponse(Tile tile) throws GeoWebCacheException, IOException { 
     206    public Tile getTile(Tile tile) throws GeoWebCacheException, IOException { 
    261207        MimeType mime = tile.getMimeType(); 
    262208 
     
    278224        // Okay, so we need to go to the backend 
    279225        if (mime.supportsTiling()) { 
    280             return getMetatilingReponse(tile); 
     226            return getMetatilingReponse(tile, true); 
    281227        } else { 
    282             return getNonMetatilingReponse(tile); 
    283         } 
    284     } 
     228            return getNonMetatilingReponse(tile, true); 
     229        } 
     230    } 
     231     
     232     
     233    /** 
     234     * Used for seeding 
     235     */ 
     236    public void seedTile(Tile tile, boolean tryCache) throws GeoWebCacheException, IOException {      
     237        if (tile.getMimeType().supportsTiling()) { 
     238            getMetatilingReponse(tile, tryCache); 
     239        } else { 
     240            getNonMetatilingReponse(tile, tryCache); 
     241        } 
     242    } 
     243     
    285244 
    286245    /** 
    287246     * Metatiling request forwarding 
    288247     *  
    289      * @param tileRequest 
    290      * @param gridLoc 
    291      * @param mime 
    292      * @param idx 
    293      * @param response 
    294      * @return 
     248     * @param tile the Tile with all the information 
     249     * @param tryCache whether to try the cache, or seed 
    295250     * @throws GeoWebCacheException 
    296251     */ 
    297     private Tile getMetatilingReponse(Tile tile) throws GeoWebCacheException { 
    298  
     252    private Tile getMetatilingReponse(Tile tile, boolean tryCache)  
     253    throws GeoWebCacheException { 
    299254        //int idx = this.getSRSIndex(tile.getSRS()); 
    300255        int[] gridLoc = tile.getTileIndex(); 
     
    318273        try { 
    319274            /** ****************** Check cache again ************** */ 
    320             if (tryCacheFetch(tile)) { 
     275            if (tryCache && tryCacheFetch(tile)) { 
    321276                // Someone got it already, return lock and we're done 
    322277                removeFromQueue(metaGlo, condIdx); 
     
    370325     * Non-metatiling forward to backend 
    371326     *  
    372      * @param tileRequest 
    373      * @param gridLoc 
    374      * @param mime 
    375      * @param idx 
    376      * @param response 
    377      * @return 
    378      */ 
    379     private Tile getNonMetatilingReponse(Tile tile) throws GeoWebCacheException { 
     327     * @param tile the Tile with all the information 
     328     * @param tryCache whether to try the cache, or seed 
     329     * @throws GeoWebCacheException 
     330     */ 
     331    private Tile getNonMetatilingReponse(Tile tile, boolean tryCache)  
     332    throws GeoWebCacheException { 
    380333        // String debugHeadersStr = null; 
    381334        int[] gridLoc = tile.getTileIndex(); 
     
    387340        try { 
    388341            /** ****************** Check cache again ************** */ 
    389             if (tryCacheFetch(tile)) { 
     342            if (tryCache && tryCacheFetch(tile)) { 
    390343                // Someone got it already, return lock and we're done 
    391344                removeFromQueue(glo, condIdx); 
  • trunk/geowebcache/src/main/java/org/geowebcache/rest/SeedTask.java

    r369 r370  
    7878            int TOTAL_TILES = tileCount(coveredGridLevels, zoomStart, zoomStop);  
    7979            int count = 0; 
     80            boolean tryCache = !reseed; 
    8081             
    8182            for (int level = zoomStart; level <= zoomStop; level++) { 
     
    9091                                null, null); 
    9192                        try { 
    92                             tl.getResponse(tile); 
     93                            tl.seedTile(tile, tryCache); 
    9394                        } catch (GeoWebCacheException e) { 
    9495                            e.printStackTrace(); 
  • trunk/geowebcache/src/main/java/org/geowebcache/service/kml/KMLDebugGridLayer.java

    r340 r370  
    182182    } 
    183183 
    184     public Tile getResponse(Tile tile) 
     184    public Tile getTile(Tile tile) 
    185185            throws GeoWebCacheException, IOException { 
    186186        // TODO Auto-generated method stub 
     
    516516    } 
    517517 
     518    @Override 
     519    public void seedTile(Tile tile, boolean tryCache) 
     520            throws GeoWebCacheException, IOException { 
     521        // TODO Auto-generated method stub 
     522         
     523    } 
     524 
    518525} 
  • trunk/geowebcache/src/main/java/org/geowebcache/service/kml/KMLService.java

    r359 r370  
    348348            try { 
    349349                tile.setWrapperMimeType(null); 
    350                 tileLayer.getResponse(tile); 
     350                tileLayer.getTile(tile); 
    351351                tile.setWrapperMimeType(XMLMime.kmz); 
    352352            } catch (IOException ioe) { 
  • trunk/geowebcache/src/main/java/org/geowebcache/service/kml/KMZHelper.java

    r337 r370  
    7272                 
    7373                try {                                         
    74                     tileLayer.getResponse(tile); 
     74                    tileLayer.getTile(tile); 
    7575                     
    7676                } catch (IOException ioe) {