comparison flys-backend/src/main/java/de/intevation/flys/importer/Importer.java @ 1223:268f8da412e3

Importer: Added a central configuration to allow skipping of parsing/storing individual sub systems. flys-backend/trunk@2354 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jul 2011 15:52:42 +0000
parents f08fe480092c
children 68d1661a57cf
comparison
equal deleted inserted replaced
1222:1f21f162bcf3 1223:268f8da412e3
20 import org.w3c.dom.Document; 20 import org.w3c.dom.Document;
21 21
22 public class Importer 22 public class Importer
23 { 23 {
24 private static Logger log = Logger.getLogger(Importer.class); 24 private static Logger log = Logger.getLogger(Importer.class);
25
26 public static final boolean DRY_RUN =
27 Boolean.getBoolean("flys.backend.importer.dry.run");
28
29 public static final String ANNOTATION_TYPES =
30 "flys.backend.importer.annotation.types";
31 25
32 protected List<ImportRiver> rivers; 26 protected List<ImportRiver> rivers;
33 27
34 public Importer() { 28 public Importer() {
35 } 29 }
88 throw re; 82 throw re;
89 } 83 }
90 } 84 }
91 85
92 public static AnnotationClassifier getAnnotationClassifier() { 86 public static AnnotationClassifier getAnnotationClassifier() {
93 String annotationTypes = System.getProperty(ANNOTATION_TYPES); 87 String annotationTypes = Config.INSTANCE.getAnnotationTypes();
94 88
95 if (annotationTypes == null) { 89 if (annotationTypes == null) {
96 log.info("no annotation types file configured."); 90 log.info("no annotation types file configured.");
97 return null; 91 return null;
98 } 92 }
129 catch (IOException ioe) { 123 catch (IOException ioe) {
130 log.error("cannot while parsing: " + gew); 124 log.error("cannot while parsing: " + gew);
131 } 125 }
132 } 126 }
133 127
134 if (!DRY_RUN) { 128 if (!Config.INSTANCE.dryRun()) {
135 new Importer(infoGewParser.getRivers()).writeToDatabase(); 129 new Importer(infoGewParser.getRivers()).writeToDatabase();
136 } 130 }
137 } 131 }
138 } 132 }
139 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 133 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org