Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/importer/Importer.java @ 4198:1cdbd8a0c994
Added two new tables ClickableQDTable and ClickableWTable and made Ws and Qs clickable in historical discharge calculation.
The new tables define listener interfaces (clicked lower or upper icon) to listen to user clicks.
In addition to this, there is an enum ClickMode with NONE, SINGLE and RANGE options, which allows to
specifiy, which icons are displayed in the tables. NONE means no icon for user clicks, SINGLE has 1
icon, RANGE 2 icons for lower and upper.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 13:31:25 +0200 |
parents | 36edf9a71cbd |
children | 2b0426b79a92 |
rev | line source |
---|---|
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.importer; |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
3 import de.intevation.artifacts.common.utils.XMLUtils; |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
4 |
1211
f08fe480092c
Moved file parsers to separate package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
766
diff
changeset
|
5 import de.intevation.flys.importer.parsers.InfoGewParser; |
f08fe480092c
Moved file parsers to separate package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
766
diff
changeset
|
6 import de.intevation.flys.importer.parsers.AnnotationClassifier; |
f08fe480092c
Moved file parsers to separate package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
766
diff
changeset
|
7 |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import java.io.File; |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import java.io.IOException; |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
11 import java.util.List; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
12 |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
13 import java.sql.SQLException; |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
14 |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
17 import org.hibernate.Transaction; |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
18 import org.hibernate.HibernateException; |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
19 |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
20 import org.w3c.dom.Document; |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
21 |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 public class Importer |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 { |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 private static Logger log = Logger.getLogger(Importer.class); |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
26 protected List<ImportRiver> rivers; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
27 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
28 public Importer() { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
29 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
30 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
31 public Importer(List<ImportRiver> rivers) { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
32 this.rivers = rivers; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
33 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
34 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
35 public List<ImportRiver> getRivers() { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
36 return rivers; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
37 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
38 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
39 public void setRivers(List<ImportRiver> rivers) { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
40 this.rivers = rivers; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
41 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
42 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
43 public void writeRivers() { |
182
1c0afb01bc93
Importer: Fixed error in HQL statement.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
180
diff
changeset
|
44 log.debug("write rivers started"); |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
45 |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
46 for (ImportRiver river: rivers) { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
47 log.debug("writing river '" + river.getName() + "'"); |
190
d40da430d2fe
Added stub code to write gauges
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
48 river.storeDependencies(); |
497
67fd63e4ef66
Importer: centralized caching
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
199
diff
changeset
|
49 ImporterSession.getInstance().getDatabaseSession().flush(); |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
50 } |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
51 |
182
1c0afb01bc93
Importer: Fixed error in HQL statement.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
180
diff
changeset
|
52 log.debug("write rivers finished"); |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
53 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
54 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
55 public void writeToDatabase() { |
183
222f4db3430a
Importer: Used thread local pattern to make sharing of session easier.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
182
diff
changeset
|
56 |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
57 Transaction tx = null; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
58 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
59 try { |
497
67fd63e4ef66
Importer: centralized caching
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
199
diff
changeset
|
60 tx = ImporterSession.getInstance() |
67fd63e4ef66
Importer: centralized caching
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
199
diff
changeset
|
61 .getDatabaseSession().beginTransaction(); |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
62 |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
63 try { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
64 writeRivers(); |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
65 } |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
66 catch (HibernateException he) { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
67 Throwable t = he.getCause(); |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
68 while (t instanceof SQLException) { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
69 SQLException sqle = (SQLException)t; |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
70 log.error("SQL exeception chain:", sqle); |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
71 t = sqle.getNextException(); |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
72 } |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
73 throw he; |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
183
diff
changeset
|
74 } |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
75 |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
76 tx.commit(); |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
77 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
78 catch (RuntimeException re) { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
79 if (tx != null) { |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
80 tx.rollback(); |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
81 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
82 throw re; |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
83 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
84 } |
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
85 |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
86 public static AnnotationClassifier getAnnotationClassifier() { |
1223
268f8da412e3
Importer: Added a central configuration to allow skipping of parsing/storing individual sub systems.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1211
diff
changeset
|
87 String annotationTypes = Config.INSTANCE.getAnnotationTypes(); |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
88 |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
89 if (annotationTypes == null) { |
766
aa9e3da95c31
Importer: Fix import of annotation type classification.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
765
diff
changeset
|
90 log.info("no annotation types file configured."); |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
91 return null; |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
92 } |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
93 |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
94 File file = new File(annotationTypes); |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
95 |
766
aa9e3da95c31
Importer: Fix import of annotation type classification.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
765
diff
changeset
|
96 log.info("use annotation types file '" + file + "'"); |
aa9e3da95c31
Importer: Fix import of annotation type classification.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
765
diff
changeset
|
97 |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
98 if (!(file.isFile() && file.canRead())) { |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
99 log.warn("annotation type file '" + file + "' is not readable."); |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
100 return null; |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
101 } |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
102 |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
103 Document rules = XMLUtils.parseDocument(file); |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
104 |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
105 if (rules == null) { |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
106 log.warn("cannot parse annotation types file."); |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
107 return null; |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
108 } |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
109 |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
110 return new AnnotationClassifier(rules); |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
111 } |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
112 |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 public static void main(String [] args) { |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 |
765
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
115 InfoGewParser infoGewParser = new InfoGewParser( |
763c4137d6e1
Added classification of annotation types. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
497
diff
changeset
|
116 getAnnotationClassifier()); |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 |
2806
33f40b23edd8
Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2804
diff
changeset
|
118 log.info("Start parsing rivers..."); |
33f40b23edd8
Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2804
diff
changeset
|
119 |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 for (String gew: args) { |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 log.info("parsing info gew file: " + gew); |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 try { |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 infoGewParser.parse(new File(gew)); |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 } |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 catch (IOException ioe) { |
3659
36edf9a71cbd
backend: Mention backend errors in importer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2806
diff
changeset
|
126 log.error("error while parsing gew: " + gew); |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 } |
180
3908bfb2aa43
Store imported rivers into database. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
177
diff
changeset
|
129 |
2804
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
130 String gew = Config.INSTANCE.getInfoGewFile(); |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
131 if (gew != null && gew.length() > 0) { |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
132 log.info("parsing info gew file: " + gew); |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
133 try { |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
134 infoGewParser.parse(new File(gew)); |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
135 } |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
136 catch (IOException ioe) { |
3659
36edf9a71cbd
backend: Mention backend errors in importer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2806
diff
changeset
|
137 log.error("error while parsing gew: " + gew); |
2804
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
138 } |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
139 } |
68d1661a57cf
Added a new config option to specify a INFO.gew file by system property.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1223
diff
changeset
|
140 |
1223
268f8da412e3
Importer: Added a central configuration to allow skipping of parsing/storing individual sub systems.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1211
diff
changeset
|
141 if (!Config.INSTANCE.dryRun()) { |
199
ed38839a6b08
Ported over some WST parsing stuff from desktop flys
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
190
diff
changeset
|
142 new Importer(infoGewParser.getRivers()).writeToDatabase(); |
ed38839a6b08
Ported over some WST parsing stuff from desktop flys
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
190
diff
changeset
|
143 } |
177
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 } |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 } |
31895d24387e
Importer: Added info gew parser.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |