- Timestamp:
- 11/17/08 16:26:53 (7 weeks ago)
- Location:
- trunk/geowebcache/src/main/java/org/geowebcache
- Files:
-
- 3 modified
-
cache/file/FileCache.java (modified) (1 diff)
-
layer/TileLayerDispatcher.java (modified) (1 diff)
-
util/XMLConfiguration.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/cache/file/FileCache.java
r424 r426 49 49 public final static String GS_DATA_DIR = "GEOSERVER_DATA_DIR"; 50 50 51 private static Log log = LogFactory 52 .getLog(org.geowebcache.cache.file.FileCache.class); 51 private static Log log = LogFactory.getLog(org.geowebcache.cache.file.FileCache.class); 53 52 54 53 private String defaultKeyBeanId = null; -
trunk/geowebcache/src/main/java/org/geowebcache/layer/TileLayerDispatcher.java
r399 r426 110 110 Configuration config = configIter.next(); 111 111 112 try { 113 configLayers = config.getTileLayers(); 114 } catch (GeoWebCacheException gwce) { 115 log.error(gwce.getMessage()); 116 log.error("Failed to add layers from " 117 + config.getIdentifier()); 118 } 112 String configIdent = config.getIdentifier(); 119 113 120 log.info("Adding layers from " + config.getIdentifier());121 if (configLayers != null && configLayers.size() > 0){122 Iterator<Entry<String,TileLayer>> iter = configLayers.entrySet().iterator();123 while (iter.hasNext()) {124 Entry<String,TileLayer> one = iter.next();125 l ayers.put(one.getKey(), one.getValue());114 if (configIdent != null) { 115 try { 116 configLayers = config.getTileLayers(); 117 } catch (GeoWebCacheException gwce) { 118 log.error(gwce.getMessage()); 119 log.error("Failed to add layers from " + configIdent); 126 120 } 127 } else { 128 log.error("Configuration " + config.getIdentifier() 129 + " contained no layers."); 121 122 log.info("Adding layers from " + configIdent); 123 if (configLayers != null && configLayers.size() > 0) { 124 Iterator<Entry<String, TileLayer>> iter = configLayers 125 .entrySet().iterator(); 126 while (iter.hasNext()) { 127 Entry<String, TileLayer> one = iter.next(); 128 layers.put(one.getKey(), one.getValue()); 129 } 130 } else { 131 log.error("Configuration " + configIdent 132 + " contained no layers."); 133 } 130 134 } 131 135 } -
trunk/geowebcache/src/main/java/org/geowebcache/util/XMLConfiguration.java
r417 r426 97 97 File xmlFile = null; 98 98 if (configH != null) { 99 // Find the property file100 99 xmlFile = new File(configH.getAbsolutePath() + File.separator + CONFIGURATION_FILE_NAME); 101 100 } else { … … 120 119 121 120 HashMap<String, TileLayer> layers = new HashMap<String, TileLayer>(); 122 121 123 122 // load configurations into Document 124 123 Document docc = loadIntoDocument(xmlFile); 125 Element root = docc.getDocumentElement(); 126 NodeList allLayerNodes = root.getChildNodes(); 127 128 XStream xs = getConfiguredXStream(new XStream()); 129 130 TileLayer result = null; 131 for (int i = 0; i < allLayerNodes.getLength(); i++) { 132 if (allLayerNodes.item(i) instanceof Element) { 133 Element e = (Element) allLayerNodes.item(i); 134 if (e.getTagName().equalsIgnoreCase("wmslayer")) 135 result = (WMSLayer) xs.unmarshal(new DomReader( 136 (Element) allLayerNodes.item(i))); 137 result.setCacheFactory(this.cacheFactory); 138 layers.put(result.getName(), result); 139 } 124 if(docc != null) { 125 Element root = docc.getDocumentElement(); 126 NodeList allLayerNodes = root.getChildNodes(); 127 128 XStream xs = getConfiguredXStream(new XStream()); 129 130 TileLayer result = null; 131 for (int i = 0; i < allLayerNodes.getLength(); i++) { 132 if (allLayerNodes.item(i) instanceof Element) { 133 Element e = (Element) allLayerNodes.item(i); 134 if (e.getTagName().equalsIgnoreCase("wmslayer")) 135 result = (WMSLayer) xs.unmarshal(new DomReader( 136 (Element) allLayerNodes.item(i))); 137 result.setCacheFactory(this.cacheFactory); 138 layers.put(result.getName(), result); 139 } 140 } 141 } else { 142 140 143 } 141 144 … … 382 385 383 386 if (!configH.exists() || !configH.canRead()) { 384 log.error( configH.getAbsoluteFile()+ "cannot be read or does not exist!");387 log.error("Configuration file cannot be read or does not exist!"); 385 388 } 386 389 } … … 388 391 389 392 public String getIdentifier() { 390 return configH.getAbsolutePath(); 393 if(configH != null) { 394 return configH.getAbsolutePath(); 395 } else { 396 return null; 397 } 391 398 } 392 399
