comparison flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java @ 2742:faf73245ec73

Improved startup performance. flys-artifacts/trunk@4476 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 23 May 2012 11:02:50 +0000
parents 83b22ccf48da
children 74c974b10c75
comparison
equal deleted inserted replaced
2741:0251393f037c 2742:faf73245ec73
158 } 158 }
159 return themes; 159 return themes;
160 } 160 }
161 161
162 protected static String getName(Node config) { 162 protected static String getName(Node config) {
163 return (String) XMLUtils.xpath(config, "@name", XPathConstants.STRING); 163 return ((Element)config).getAttribute("name");
164 } 164 }
165 165
166 166
167 protected static String getDescription(Node config) { 167 protected static String getDescription(Node config) {
168 return (String) XMLUtils.xpath(config, "@desc", XPathConstants.STRING); 168 return ((Element)config).getAttribute("desc");
169 } 169 }
170 170
171 171
172 protected static void parseInherits(Document themeCfg, Node cfg, Theme t) { 172 protected static void parseInherits(Document themeCfg, Node cfg, Theme t) {
173 parseInherits(themeCfg, cfg, t, null); 173 parseInherits(themeCfg, cfg, t, null);
179 Theme t, 179 Theme t,
180 Map<String, Node> themes 180 Map<String, Node> themes
181 ) { 181 ) {
182 logger.debug("ThemeFactory.parseInherits"); 182 logger.debug("ThemeFactory.parseInherits");
183 183
184 NodeList inherits = (NodeList) XMLUtils.xpath( 184 NodeList inherits = ((Element)cfg).getElementsByTagName("inherit");
185 cfg, "inherits/inherit", XPathConstants.NODESET); 185
186 186 int num = inherits.getLength();
187 int num = inherits != null ? inherits.getLength() : 0;
188 187
189 if (num == 0) { 188 if (num == 0) {
190 logger.debug("Theme does not inherit from other themes."); 189 logger.debug("Theme does not inherit from other themes.");
191 return; 190 return;
192 } 191 }
230 if (config == null || theme == null) { 229 if (config == null || theme == null) {
231 logger.warn("Parsing fields without node or theme is senseless!"); 230 logger.warn("Parsing fields without node or theme is senseless!");
232 return; 231 return;
233 } 232 }
234 233
235 NodeList fields = (NodeList) XMLUtils.xpath( 234 NodeList fields = ((Element)config).getElementsByTagName("field");
236 config, "fields/field", XPathConstants.NODESET); 235
237 236 int num = fields.getLength();
238 int num = fields != null ? fields.getLength() : 0;
239 237
240 logger.debug("Found " + num + " own fields in this theme."); 238 logger.debug("Found " + num + " own fields in this theme.");
241 239
242 if (num == 0) { 240 if (num == 0) {
243 logger.debug("Theme has no own fields."); 241 logger.debug("Theme has no own fields.");

http://dive4elements.wald.intevation.org