comparison gwt-client/src/main/java/org/dive4elements/river/client/server/features/XMLFileFeatures.java @ 8203:238fc722f87a

sed 's/logger/log/g' src/**/*.java
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 13:19:22 +0200
parents ea9eef426962
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8202:e4606eae8ea5 8203:238fc722f87a
27 27
28 import org.dive4elements.artifacts.common.utils.XMLUtils; 28 import org.dive4elements.artifacts.common.utils.XMLUtils;
29 29
30 public class XMLFileFeatures implements Features { 30 public class XMLFileFeatures implements Features {
31 31
32 private static final Logger logger = 32 private static final Logger log =
33 Logger.getLogger(XMLFileFeatures.class); 33 Logger.getLogger(XMLFileFeatures.class);
34 34
35 private Map<String, List<String>> featuremap = 35 private Map<String, List<String>> featuremap =
36 new HashMap<String, List<String>>(); 36 new HashMap<String, List<String>>();
37 37
38 private final static String XPATH_FEATURES = "ftr:feature/child::text()"; 38 private final static String XPATH_FEATURES = "ftr:feature/child::text()";
39 private final static String XPATH_ROLES = "/ftr:features/ftr:role"; 39 private final static String XPATH_ROLES = "/ftr:features/ftr:role";
40 40
41 public XMLFileFeatures(String filename) throws IOException { 41 public XMLFileFeatures(String filename) throws IOException {
42 FileInputStream finput = new FileInputStream(filename); 42 FileInputStream finput = new FileInputStream(filename);
43 logger.debug("XMLFileFeatures: " + filename); 43 log.debug("XMLFileFeatures: " + filename);
44 try { 44 try {
45 Document doc = XMLUtils.parseDocument(finput); 45 Document doc = XMLUtils.parseDocument(finput);
46 46
47 NodeList roles = (NodeList) XMLUtils.xpath( 47 NodeList roles = (NodeList) XMLUtils.xpath(
48 doc, 48 doc,
53 for(int i = 0, m = roles.getLength(); i < m; i++) { 53 for(int i = 0, m = roles.getLength(); i < m; i++) {
54 Element rolenode = (Element)roles.item(i); 54 Element rolenode = (Element)roles.item(i);
55 55
56 String name = rolenode.getAttribute("name"); 56 String name = rolenode.getAttribute("name");
57 57
58 logger.debug("Found role: " + name); 58 log.debug("Found role: " + name);
59 59
60 NodeList features = (NodeList) XMLUtils.xpath( 60 NodeList features = (NodeList) XMLUtils.xpath(
61 rolenode, 61 rolenode,
62 XPATH_FEATURES, 62 XPATH_FEATURES,
63 XPathConstants.NODESET, 63 XPathConstants.NODESET,
73 List<String> allowed = new ArrayList<String>(N); 73 List<String> allowed = new ArrayList<String>(N);
74 for (int j = 0; j < N; j++) { 74 for (int j = 0; j < N; j++) {
75 Node featurenode = features.item(j); 75 Node featurenode = features.item(j);
76 String featurename = featurenode.getNodeValue(); 76 String featurename = featurenode.getNodeValue();
77 77
78 logger.debug("Found feature: " + featurename); 78 log.debug("Found feature: " + featurename);
79 79
80 allowed.add(featurename); 80 allowed.add(featurename);
81 } 81 }
82 featuremap.put(name, allowed); 82 featuremap.put(name, allowed);
83 } 83 }
84 } 84 }
85 logger.debug("Loaded all features"); 85 log.debug("Loaded all features");
86 } 86 }
87 finally { 87 finally {
88 finput.close(); 88 finput.close();
89 } 89 }
90 } 90 }

http://dive4elements.wald.intevation.org