Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/collections/AttributeParser.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | b4faf69ad1d0 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
41 /** Constant XPath that points to the outputmodes of an artifact. */ | 41 /** Constant XPath that points to the outputmodes of an artifact. */ |
42 public static final String XPATH_ARTIFACT_OUTPUTMODES = | 42 public static final String XPATH_ARTIFACT_OUTPUTMODES = |
43 "/art:attribute/art:outputs/art:output"; | 43 "/art:attribute/art:outputs/art:output"; |
44 | 44 |
45 | 45 |
46 private static Logger logger = Logger.getLogger(AttributeParser.class); | 46 private static Logger log = Logger.getLogger(AttributeParser.class); |
47 | 47 |
48 | 48 |
49 protected Document attributeDocument; | 49 protected Document attributeDocument; |
50 | 50 |
51 protected CollectionAttribute attribute; | 51 protected CollectionAttribute attribute; |
56 this.attributeDocument = attributeDocument; | 56 this.attributeDocument = attributeDocument; |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 public void parse() { | 60 public void parse() { |
61 logger.debug("AttributeParser.parse"); | 61 log.debug("AttributeParser.parse"); |
62 | 62 |
63 attribute = new CollectionAttribute(); | 63 attribute = new CollectionAttribute(); |
64 | 64 |
65 NodeList outs = (NodeList) XMLUtils.xpath( | 65 NodeList outs = (NodeList) XMLUtils.xpath( |
66 attributeDocument, | 66 attributeDocument, |
68 XPathConstants.NODESET, | 68 XPathConstants.NODESET, |
69 ArtifactNamespaceContext.INSTANCE); | 69 ArtifactNamespaceContext.INSTANCE); |
70 | 70 |
71 int num = outs != null ? outs.getLength() : 0; | 71 int num = outs != null ? outs.getLength() : 0; |
72 | 72 |
73 logger.debug("Attribute has " + num + " outputs."); | 73 log.debug("Attribute has " + num + " outputs."); |
74 | 74 |
75 for (int i = 0; i < num; i++) { | 75 for (int i = 0; i < num; i++) { |
76 Node out = outs.item(i); | 76 Node out = outs.item(i); |
77 | 77 |
78 parseOutput(out); | 78 parseOutput(out); |
110 | 110 |
111 protected void parseOutput(Node out) { | 111 protected void parseOutput(Node out) { |
112 String name = ((Element)out).getAttribute("name"); | 112 String name = ((Element)out).getAttribute("name"); |
113 | 113 |
114 if (name.length() == 0) { | 114 if (name.length() == 0) { |
115 logger.warn("No Output name specified. Cancel parsing!"); | 115 log.warn("No Output name specified. Cancel parsing!"); |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 Output o = attribute.getOutput(name); | 119 Output o = attribute.getOutput(name); |
120 | 120 |
121 if (o == null) { | 121 if (o == null) { |
122 logger.debug("Create new output: " + name); | 122 log.debug("Create new output: " + name); |
123 | 123 |
124 o = new DefaultOutput(name, null, null); | 124 o = new DefaultOutput(name, null, null); |
125 attribute.addOutput(name, o); | 125 attribute.addOutput(name, o); |
126 } | 126 } |
127 | 127 |
144 | 144 |
145 protected void parseSettings(Node out, String outname) { | 145 protected void parseSettings(Node out, String outname) { |
146 Node settingsNode = getChild((Element)out, "settings"); | 146 Node settingsNode = getChild((Element)out, "settings"); |
147 | 147 |
148 if (settingsNode == null) { | 148 if (settingsNode == null) { |
149 logger.debug("No Settings found for Output '" + outname + "'"); | 149 log.debug("No Settings found for Output '" + outname + "'"); |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 Settings settings = ChartSettings.parse(settingsNode); | 153 Settings settings = ChartSettings.parse(settingsNode); |
154 attribute.setSettings(outname, settings); | 154 attribute.setSettings(outname, settings); |
161 | 161 |
162 NodeList themes = element.getElementsByTagNameNS(uri, "facet"); | 162 NodeList themes = element.getElementsByTagNameNS(uri, "facet"); |
163 | 163 |
164 int num = themes.getLength(); | 164 int num = themes.getLength(); |
165 | 165 |
166 logger.debug("Output has " + num + " themes."); | 166 log.debug("Output has " + num + " themes."); |
167 | 167 |
168 for (int i = 0; i < num; i++) { | 168 for (int i = 0; i < num; i++) { |
169 Element theme = (Element) themes.item(i); | 169 Element theme = (Element) themes.item(i); |
170 if (theme.getParentNode() == out) { | 170 if (theme.getParentNode() == out) { |
171 attribute.addFacet(outname, new ManagedDomFacet(theme)); | 171 attribute.addFacet(outname, new ManagedDomFacet(theme)); |