Changeset 417
- Timestamp:
- 11/11/08 09:07:39 (2 months ago)
- Location:
- trunk/geowebcache/src/main/java/org/geowebcache
- Files:
-
- 2 modified
-
cache/file/FileCache.java (modified) (1 diff)
-
util/XMLConfiguration.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/cache/file/FileCache.java
r348 r417 35 35 import org.geowebcache.cache.CacheException; 36 36 import org.geowebcache.cache.CacheKey; 37 import org.geowebcache.layer.wms.WMSLayer;38 37 import org.geowebcache.tile.Tile; 39 38 import org.geowebcache.util.GWCVars; -
trunk/geowebcache/src/main/java/org/geowebcache/util/XMLConfiguration.java
r416 r417 36 36 import org.apache.commons.logging.LogFactory; 37 37 import org.geowebcache.GeoWebCacheException; 38 import org.geowebcache.cache.CacheException; 38 39 import org.geowebcache.cache.CacheFactory; 40 import org.geowebcache.cache.file.FileCache; 41 import org.geowebcache.cache.file.FilePathKey2; 39 42 import org.geowebcache.layer.Grid; 40 43 import org.geowebcache.layer.TileLayer; … … 72 75 private File configH = null; 73 76 77 private FileCache fileCache = null; 78 74 79 /** 75 80 * XMLConfiguration class responsible for reading/writing layer … … 320 325 /* 321 326 * Try 322 * 1) absolute path 323 * 2) relative path 324 * 3) standard paths 327 * 1) absolute path (specified in bean defn) 328 * 2) relative path (specified in bean defn) 329 * 3) environment variables 330 * 4) standard paths 325 331 */ 326 332 if (absPath != null) { … … 331 337 + configH.getAbsolutePath()); 332 338 } else if (relPath == null) { 333 for (int i = 0; i < CONFIGURATION_REL_PATHS.length; i++) { 334 relPath = CONFIGURATION_REL_PATHS[i]; 335 if (File.separator.equals("\\")) { 336 relPath = relPath.replace("/", "\\"); 339 // Try env variables 340 File tmpPath = null; 341 342 if (fileCache != null) { 343 try { 344 // Careful, this appends a separator 345 tmpPath = new File(fileCache.getDefaultPrefix(CONFIGURATION_FILE_NAME)); 346 347 if (tmpPath.exists() && tmpPath.canRead()) { 348 String filePath = tmpPath.getAbsolutePath(); 349 configH = new File(filePath.substring(0, 350 filePath.length() 351 - CONFIGURATION_FILE_NAME.length() - 1)); 352 } 353 } catch (CacheException ce) { 354 // Ignore 337 355 } 338 339 File tmpPath = new File(baseDir + relPath + File.separator 340 + CONFIGURATION_FILE_NAME); 341 342 if (tmpPath.exists()) { 343 log.info("No configuration directory was specified, using " 344 + tmpPath.getAbsolutePath()); 345 configH = new File(baseDir + relPath); 356 } 357 358 // Finally, try "standard" paths if we have to. 359 if (configH == null) { 360 for (int i = 0; i < CONFIGURATION_REL_PATHS.length; i++) { 361 relPath = CONFIGURATION_REL_PATHS[i]; 362 if (File.separator.equals("\\")) { 363 relPath = relPath.replace("/", "\\"); 364 } 365 366 tmpPath = new File(baseDir + relPath + File.separator 367 + CONFIGURATION_FILE_NAME); 368 369 if (tmpPath.exists() && tmpPath.canRead()) { 370 log.info("No configuration directory was specified, using " 371 + tmpPath.getAbsolutePath()); 372 configH = new File(baseDir + relPath); 373 } 346 374 } 347 375 } … … 349 377 350 378 if(configH == null) { 351 log.error("Failed to find geowebcache.xml, please specify an absolute path " 352 +"in geowebcache-servlet.xml!"); 379 log.error("Failed to find geowebcache.xml"); 353 380 } else { 354 381 log.info("Configuration directory set to: "+ configH.getAbsolutePath()); … … 370 397 public void setAbsolutePath(String absPath) { 371 398 this.absPath = absPath; 399 } 400 401 public void setFileCache(FileCache fileCache) { 402 this.fileCache = fileCache; 372 403 } 373 404
