Mercurial > dive4elements > river
changeset 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 | 0251393f037c |
children | 10e6400d4166 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java |
diffstat | 3 files changed, 19 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed May 23 10:17:06 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed May 23 11:02:50 2012 +0000 @@ -1,3 +1,9 @@ +2012-05-23 Raimund Renkert <raimund.renkert@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java, + src/main/java/de/intevation/flys/themes/ThemeFactory.java: + Improved startup performance. + 2012-05-23 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Wed May 23 10:17:06 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Wed May 23 11:02:50 2012 +0000 @@ -368,24 +368,15 @@ new HashMap<String, List<ThemeMapping>>(); for (int i = 0; i < num; i++) { - Node node = mappings.item(i); - - String from = (String) XMLUtils.xpath( - node, "@from", XPathConstants.STRING); - - String to = (String) XMLUtils.xpath( - node, "@to", XPathConstants.STRING); + Element node = (Element)mappings.item(i); - String pattern = (String) XMLUtils.xpath( - node, "@pattern", XPathConstants.STRING); + String from = node.getAttribute("from"); + String to = node.getAttribute("to"); + String pattern = node.getAttribute("pattern"); + String masterAttrPattern = node.getAttribute("masterAttr"); + String outputPattern = node.getAttribute("output"); - String masterAttrPattern = (String) XMLUtils.xpath( - node, "@masterAttr", XPathConstants.STRING); - - String outputPattern = (String) XMLUtils.xpath( - node, "@output", XPathConstants.STRING); - - if (from != null && to != null) { + if (from.length() > 0 && to.length() > 0) { List<ThemeMapping> tm = mapping.get(from); if (tm == null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Wed May 23 10:17:06 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Wed May 23 11:02:50 2012 +0000 @@ -160,12 +160,12 @@ } protected static String getName(Node config) { - return (String) XMLUtils.xpath(config, "@name", XPathConstants.STRING); + return ((Element)config).getAttribute("name"); } protected static String getDescription(Node config) { - return (String) XMLUtils.xpath(config, "@desc", XPathConstants.STRING); + return ((Element)config).getAttribute("desc"); } @@ -181,10 +181,9 @@ ) { logger.debug("ThemeFactory.parseInherits"); - NodeList inherits = (NodeList) XMLUtils.xpath( - cfg, "inherits/inherit", XPathConstants.NODESET); + NodeList inherits = ((Element)cfg).getElementsByTagName("inherit"); - int num = inherits != null ? inherits.getLength() : 0; + int num = inherits.getLength(); if (num == 0) { logger.debug("Theme does not inherit from other themes."); @@ -232,10 +231,9 @@ return; } - NodeList fields = (NodeList) XMLUtils.xpath( - config, "fields/field", XPathConstants.NODESET); + NodeList fields = ((Element)config).getElementsByTagName("field"); - int num = fields != null ? fields.getLength() : 0; + int num = fields.getLength(); logger.debug("Found " + num + " own fields in this theme.");