comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java @ 870:dfd02f8d3602

Removed trailing whitespace. gnv-artifacts/trunk@1010 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 28 Apr 2010 06:53:44 +0000
parents 797a6264b89b
children f953c9a559d8
comparison
equal deleted inserted replaced
869:27112636e8bb 870:dfd02f8d3602
36 36
37 /** 37 /**
38 * the logger, used to log exceptions and additonaly information 38 * the logger, used to log exceptions and additonaly information
39 */ 39 */
40 private static Logger log = Logger.getLogger(ThematicDataCacheCleaner.class); 40 private static Logger log = Logger.getLogger(ThematicDataCacheCleaner.class);
41 41
42 private final static String XPATH_ARTIFACTS = 42 private final static String XPATH_ARTIFACTS =
43 "/artifact-database/artifacts/artifact"; 43 "/artifact-database/artifacts/artifact";
44 private final static String XPATH_STATES = "states/state"; 44 private final static String XPATH_STATES = "states/state";
45 private final static String XPATH_STATEID = "id"; 45 private final static String XPATH_STATEID = "id";
46 private final static String XPATH_QUERYID = "queryID"; 46 private final static String XPATH_QUERYID = "queryID";
47 47
139 XPATH_ARTIFACTS); 139 XPATH_ARTIFACTS);
140 log.debug("ThematicDataCacheCleaner.setUp()"); 140 log.debug("ThematicDataCacheCleaner.setUp()");
141 if (artifactList != null && artifactList.getLength() > 0){ 141 if (artifactList != null && artifactList.getLength() > 0){
142 for (int i = 0; i < artifactList.getLength(); i++){ 142 for (int i = 0; i < artifactList.getLength(); i++){
143 Element currentArtifactNode = (Element)artifactList.item(i); 143 Element currentArtifactNode = (Element)artifactList.item(i);
144 144
145 String link = currentArtifactNode.getAttribute("xlink:href"); 145 String link = currentArtifactNode.getAttribute("xlink:href");
146 if (link != null && link.length() > 0){ 146 if (link != null && link.length() > 0){
147 String absolutFileName = Config.replaceConfigDir(link); 147 String absolutFileName = Config.replaceConfigDir(link);
148 currentArtifactNode = (Element)new ArtifactXMLUtilities() 148 currentArtifactNode = (Element)new ArtifactXMLUtilities()
149 .readConfiguration(absolutFileName); 149 .readConfiguration(absolutFileName);
153 if (stateList != null && stateList.getLength() > 0){ 153 if (stateList != null && stateList.getLength() > 0){
154 for (int j = 0; j < stateList.getLength() ; j++){ 154 for (int j = 0; j < stateList.getLength() ; j++){
155 Element currentStateNode = (Element)stateList.item(j); 155 Element currentStateNode = (Element)stateList.item(j);
156 String stateId = currentStateNode 156 String stateId = currentStateNode
157 .getAttribute(XPATH_STATEID); 157 .getAttribute(XPATH_STATEID);
158 String queryID = Config.getStringXPath(currentStateNode, 158 String queryID = Config.getStringXPath(currentStateNode,
159 XPATH_QUERYID); 159 XPATH_QUERYID);
160 try { 160 try {
161 if (queryID != null){ 161 if (queryID != null){
162 String query = QueryContainerFactory 162 String query = QueryContainerFactory
163 .getInstance() 163 .getInstance()
213 log.debug("ThematicDataCacheCleaner.cleanUpCache "+stateId); 213 log.debug("ThematicDataCacheCleaner.cleanUpCache "+stateId);
214 CacheFactory factory = CacheFactory.getInstance(); 214 CacheFactory factory = CacheFactory.getInstance();
215 Cache cache = factory.getCache(); 215 Cache cache = factory.getCache();
216 List<String> keys = cache.getKeys(); 216 List<String> keys = cache.getKeys();
217 String keySample = StateBase.HASH_ID_SEPARATOR + 217 String keySample = StateBase.HASH_ID_SEPARATOR +
218 stateId + 218 stateId +
219 StateBase.HASH_ID_SEPARATOR; 219 StateBase.HASH_ID_SEPARATOR;
220 if (keys != null && keys.size() > 0){ 220 if (keys != null && keys.size() > 0){
221 Iterator<String> it = keys.iterator(); 221 Iterator<String> it = keys.iterator();
222 while (it.hasNext()){ 222 while (it.hasNext()){
223 String key = it.next(); 223 String key = it.next();
224 if (key != null && key.contains(keySample)){ 224 if (key != null && key.contains(keySample)){
225 boolean removed = cache.remove(key); 225 boolean removed = cache.remove(key);
226 if (!removed){ 226 if (!removed){
227 log.warn("Object with Key " + 227 log.warn("Object with Key " +
228 key + "could not be removed from Cache"); 228 key + "could not be removed from Cache");
229 }else{ 229 }else{
230 log.debug("Object with Key " + 230 log.debug("Object with Key " +
231 key + "has been removed from Cache"); 231 key + "has been removed from Cache");
232 } 232 }
233 } 233 }
234 } 234 }
235 } 235 }

http://dive4elements.wald.intevation.org