# HG changeset patch # User Raimund Renkert # Date 1337770970 0 # Node ID faf73245ec73a19029beb80299de5ada9ec62734 # Parent 0251393f037ca0513649343fa36164d4c848dca6 Improved startup performance. flys-artifacts/trunk@4476 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0251393f037c -r faf73245ec73 flys-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java diff -r 0251393f037c -r faf73245ec73 flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.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>(); 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 tm = mapping.get(from); if (tm == null) { diff -r 0251393f037c -r faf73245ec73 flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java --- 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.");