- Timestamp:
- 09/02/08 22:50:21 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/layer/wms/WMSLayer.java
r348 r370 67 67 private String errormime; 68 68 69 //private int width;70 71 //private int height;72 73 69 private String version; 74 70 … … 85 81 private String vendorParameters; 86 82 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 99 83 private transient int curWmsURL; 100 84 101 //private transient String wmsLayers;102 103 //private transient String wmsStyles;104 105 //private transient WMSParameters wmsparams;106 107 85 private transient boolean saveExpirationHeaders; 108 86 … … 134 112 135 113 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 //}143 114 144 115 public WMSLayer(String layerName, CacheFactory cacheFactory, … … 167 138 //log = LogFactory.getLog(org.geowebcache.layer.wms.WMSLayer.class); 168 139 } 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 // }191 140 192 141 public Boolean isInitialized() { … … 204 153 205 154 protected Boolean initialize() { 206 207 //lazyLayerInitialization();208 155 log = LogFactory.getLog(org.geowebcache.layer.wms.WMSLayer.class); 209 156 curWmsURL = 0; … … 214 161 //width = 256; 215 162 //height = 256; 216 217 163 //request = "GetMap"; 164 218 165 errormime = ErrorMime.vnd_ogc_se_inimage.getMimeType(); 219 166 version = "1.1.0"; … … 226 173 procQueue = new HashMap<GridLocObj, Boolean>(); 227 174 228 229 175 try { 230 176 initParameters(); … … 258 204 * @return 259 205 */ 260 public Tile get Response(Tile tile) throws GeoWebCacheException, IOException {206 public Tile getTile(Tile tile) throws GeoWebCacheException, IOException { 261 207 MimeType mime = tile.getMimeType(); 262 208 … … 278 224 // Okay, so we need to go to the backend 279 225 if (mime.supportsTiling()) { 280 return getMetatilingReponse(tile );226 return getMetatilingReponse(tile, true); 281 227 } 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 285 244 286 245 /** 287 246 * Metatiling request forwarding 288 247 * 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 295 250 * @throws GeoWebCacheException 296 251 */ 297 private Tile getMetatilingReponse(Tile tile ) throws GeoWebCacheException {298 252 private Tile getMetatilingReponse(Tile tile, boolean tryCache) 253 throws GeoWebCacheException { 299 254 //int idx = this.getSRSIndex(tile.getSRS()); 300 255 int[] gridLoc = tile.getTileIndex(); … … 318 273 try { 319 274 /** ****************** Check cache again ************** */ 320 if (tryCache Fetch(tile)) {275 if (tryCache && tryCacheFetch(tile)) { 321 276 // Someone got it already, return lock and we're done 322 277 removeFromQueue(metaGlo, condIdx); … … 370 325 * Non-metatiling forward to backend 371 326 * 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 { 380 333 // String debugHeadersStr = null; 381 334 int[] gridLoc = tile.getTileIndex(); … … 387 340 try { 388 341 /** ****************** Check cache again ************** */ 389 if (tryCache Fetch(tile)) {342 if (tryCache && tryCacheFetch(tile)) { 390 343 // Someone got it already, return lock and we're done 391 344 removeFromQueue(glo, condIdx);
