Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java @ 204:734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
gnv-artifacts/trunk@259 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 22 Oct 2009 08:50:21 +0000 |
parents | 4896d4f94bdc |
children | ee2d4134d0b3 |
comparison
equal
deleted
inserted
replaced
203:226091ed3cbd | 204:734ac082c8d1 |
---|---|
5 | 5 |
6 import java.io.OutputStream; | 6 import java.io.OutputStream; |
7 import java.util.ArrayList; | 7 import java.util.ArrayList; |
8 import java.util.Collection; | 8 import java.util.Collection; |
9 | 9 |
10 import net.sf.ehcache.Element; | |
11 | 10 |
12 import org.apache.log4j.Logger; | 11 import org.apache.log4j.Logger; |
12 import org.w3c.dom.Element; | |
13 import org.w3c.dom.Node; | 13 import org.w3c.dom.Node; |
14 import org.w3c.dom.NodeList; | 14 import org.w3c.dom.NodeList; |
15 | 15 |
16 import de.intevation.artifactdatabase.Config; | 16 import de.intevation.artifactdatabase.Config; |
17 import de.intevation.artifacts.CallMeta; | 17 import de.intevation.artifacts.CallMeta; |
76 if (outputModeList != null) { | 76 if (outputModeList != null) { |
77 log.debug(outputModeList.getLength() + " were found."); | 77 log.debug(outputModeList.getLength() + " were found."); |
78 this.outputModes = new ArrayList<OutputMode>(outputModeList | 78 this.outputModes = new ArrayList<OutputMode>(outputModeList |
79 .getLength()); | 79 .getLength()); |
80 for (int i = 0; i < outputModeList.getLength(); i++) { | 80 for (int i = 0; i < outputModeList.getLength(); i++) { |
81 Node currentNode = outputModeList.item(i); | 81 Element currentNode = (Element)outputModeList.item(i); |
82 String name = Config.getStringXPath(currentNode, "@name"); | 82 String name = currentNode.getAttribute("name"); |
83 String description = Config.getStringXPath(currentNode, | 83 String description =currentNode.getAttribute("description"); |
84 "@description"); | 84 String mimeType = currentNode.getAttribute("mime-type"); |
85 String mimeType = Config.getStringXPath(currentNode, | |
86 "@mime-type"); | |
87 | |
88 NodeList inputValuesList = Config.getNodeSetXPath(currentNode, | 85 NodeList inputValuesList = Config.getNodeSetXPath(currentNode, |
89 "parameters/inputvalue"); | 86 "parameters/inputvalue"); |
90 Collection<InputValue> inputParameters = null; | 87 Collection<InputValue> inputParameters = null; |
91 if (inputValuesList != null) { | 88 if (inputValuesList != null) { |
92 inputParameters = new ArrayList<InputValue>(inputValuesList | 89 inputParameters = new ArrayList<InputValue>(inputValuesList |
93 .getLength()); | 90 .getLength()); |
94 for (int j = 0; j < inputValuesList.getLength(); j++) { | 91 for (int j = 0; j < inputValuesList.getLength(); j++) { |
95 Node currentInputValuesNode = inputValuesList.item(j); | 92 Element currentInputValuesNode = (Element)inputValuesList.item(j); |
96 String inputValueName = Config.getStringXPath( | 93 String inputValueName = currentInputValuesNode.getAttribute("name"); |
97 currentInputValuesNode, "@name"); | 94 String inputValueType = currentInputValuesNode.getAttribute("type"); |
98 String inputValueType = Config.getStringXPath( | 95 String defaultValue =currentInputValuesNode.getAttribute("value"); |
99 currentInputValuesNode, "@type"); | |
100 String defaultValue = Config.getStringXPath( | |
101 currentInputValuesNode, "@value"); | |
102 boolean isMultiselect = false; | 96 boolean isMultiselect = false; |
103 InputValue inputValue = new DefaultInputValue( | 97 InputValue inputValue = new DefaultInputValue( |
104 inputValueName, inputValueType, defaultValue, | 98 inputValueName, inputValueType, defaultValue, |
105 isMultiselect); | 99 isMultiselect); |
106 inputParameters.add(inputValue); | 100 inputParameters.add(inputValue); |
142 protected Collection<Result> getChartResult(String uuid) { | 136 protected Collection<Result> getChartResult(String uuid) { |
143 log.debug("OutputTransitionBase.getChartResult"); | 137 log.debug("OutputTransitionBase.getChartResult"); |
144 if (CacheFactory.getInstance().isInitialized()) { | 138 if (CacheFactory.getInstance().isInitialized()) { |
145 String key = uuid + super.getID(); | 139 String key = uuid + super.getID(); |
146 log.debug("Hash for Queryelements: " + key); | 140 log.debug("Hash for Queryelements: " + key); |
147 Element value = CacheFactory.getInstance().getCache().get(key); | 141 net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); |
148 if (value != null) { | 142 if (value != null) { |
149 return (Collection<Result>) (value.getObjectValue()); | 143 return (Collection<Result>) (value.getObjectValue()); |
150 } | 144 } |
151 } | 145 } |
152 return null; | 146 return null; |
155 protected void removeChartResult(String uuid) { | 149 protected void removeChartResult(String uuid) { |
156 log.debug("OutputTransitionBase.getChartResult"); | 150 log.debug("OutputTransitionBase.getChartResult"); |
157 if (CacheFactory.getInstance().isInitialized()) { | 151 if (CacheFactory.getInstance().isInitialized()) { |
158 String key = uuid + super.getID(); | 152 String key = uuid + super.getID(); |
159 log.debug("Hash for Queryelements: " + key); | 153 log.debug("Hash for Queryelements: " + key); |
160 Element value = CacheFactory.getInstance().getCache().get(key); | 154 net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); |
161 if (value != null) { | 155 if (value != null) { |
162 CacheFactory.getInstance().getCache().remove(key); | 156 CacheFactory.getInstance().getCache().remove(key); |
163 } | 157 } |
164 } | 158 } |
165 } | 159 } |
172 protected void purifyResult(Collection<Result> result, String uuid) { | 166 protected void purifyResult(Collection<Result> result, String uuid) { |
173 log.debug("OutputTransitionBase.purifyResult"); | 167 log.debug("OutputTransitionBase.purifyResult"); |
174 if (CacheFactory.getInstance().isInitialized()) { | 168 if (CacheFactory.getInstance().isInitialized()) { |
175 String key = uuid + super.getID(); | 169 String key = uuid + super.getID(); |
176 log.debug("Hash for Queryelements: " + key); | 170 log.debug("Hash for Queryelements: " + key); |
177 CacheFactory.getInstance().getCache().put(new Element(key, result)); | 171 CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); |
178 } | 172 } |
179 } | 173 } |
180 | 174 |
181 /** | 175 /** |
182 * @see de.intevation.gnv.transition.TransitionBase#putInputData(java.util.Collection, java.lang.String) | 176 * @see de.intevation.gnv.transition.TransitionBase#putInputData(java.util.Collection, java.lang.String) |