Mercurial > dive4elements > river
comparison flys-backend/contrib/import_river.sh @ 5191:4aa748db8be3
Use less ambigious names for variables
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 07 Mar 2013 16:02:33 +0100 |
parents | 6553c8e364db |
children | 1b6d4edeeb4c |
comparison
equal
deleted
inserted
replaced
5190:7b37876b2f51 | 5191:4aa748db8be3 |
---|---|
126 echo "Unknown Option $1" | 126 echo "Unknown Option $1" |
127 usage;; | 127 usage;; |
128 esac | 128 esac |
129 done | 129 done |
130 | 130 |
131 if [ -z $USER ]; then | 131 if [ -z $DBUSER ]; then |
132 USER=$DEFAULT_USER | 132 USER=$DEFAULT_USER |
133 fi | 133 fi |
134 if [ -z $PASS ]; then | 134 if [ -z $DBPASS ]; then |
135 PASS=$DEFAULT_PASS | 135 PASS=$DEFAULT_PASS |
136 fi | 136 fi |
137 if [ -z $PORT ]; then | 137 if [ -z $DBPORT ]; then |
138 PORT=$DEFAULT_PORT | 138 PORT=$DEFAULT_PORT |
139 fi | 139 fi |
140 if [ -z $HOST ]; then | 140 if [ -z $DBHOST ]; then |
141 HOST=$DEFAULT_HOST | 141 HOST=$DEFAULT_HOST |
142 fi | 142 fi |
143 if [ -z $BACKEND_NAME ]; then | 143 if [ -z $BACKEND_NAME ]; then |
144 BACKEND_NAME=$DEFAULT_BACKEND_NAME | 144 BACKEND_NAME=$DEFAULT_BACKEND_NAME |
145 fi | 145 fi |
165 JAR=$(echo "$JAR" | sed 's/importer/importer_psql/') | 165 JAR=$(echo "$JAR" | sed 's/importer/importer_psql/') |
166 if [ ! -r "$JAR" ]; then | 166 if [ ! -r "$JAR" ]; then |
167 echo "Could not find Postgres importer $JAR" | 167 echo "Could not find Postgres importer $JAR" |
168 exit 1 | 168 exit 1 |
169 fi | 169 fi |
170 OGR_CONNECTION="PG:dbname=$BACKEND_NAME host=$HOST port=$PORT \ | 170 OGR_CONNECTION="PG:dbname=$BACKEND_NAME host=$DBHOST port=$DBPORT \ |
171 user=$USER password=$PASS" | 171 user=$DBUSER password=$DBPASS" |
172 BACKEND_DB_PREFIX="jdbc:postgresql:" | 172 BACKEND_DB_PREFIX="jdbc:postgresql:" |
173 BACKEND_DB_DRIVER="org.postgresql.Driver" | 173 BACKEND_DB_DRIVER="org.postgresql.Driver" |
174 BACKEND_DB_DIALECT="org.hibernate.dialect.PostgreSQLDialect" | 174 BACKEND_DB_DIALECT="org.hibernate.dialect.PostgreSQLDialect" |
175 else | 175 else |
176 BACKEND_DB_PREFIX="jdbc:oracle:thin:@" | 176 BACKEND_DB_PREFIX="jdbc:oracle:thin:@" |
177 BACKEND_DB_DRIVER="oracle.jdbc.OracleDriver" | 177 BACKEND_DB_DRIVER="oracle.jdbc.OracleDriver" |
178 BACKEND_DB_DIALECT="org.hibernate.dialect.OracleDialect" | 178 BACKEND_DB_DIALECT="org.hibernate.dialect.OracleDialect" |
179 fi | 179 fi |
180 | 180 |
181 BACKEND_URL=$BACKEND_DB_PREFIX//$HOST:$PORT/$BACKEND_NAME | 181 BACKEND_URL=$BACKEND_DB_PREFIX//$DBHOST:$DBPORT/$BACKEND_NAME |
182 | 182 |
183 echo "Importing $RIVER_NAME into $BACKEND_URL." | 183 echo "Importing $RIVER_NAME into $BACKEND_URL." |
184 | 184 |
185 import_hydro(){ | 185 import_hydro(){ |
186 LOG_FILE=${LOG_DIR}/hydro.log | 186 LOG_FILE=${LOG_DIR}/hydro.log |
189 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties | 189 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties |
190 java -jar \ | 190 java -jar \ |
191 -Xmx$MIN_MEMORY \ | 191 -Xmx$MIN_MEMORY \ |
192 -server \ | 192 -server \ |
193 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ | 193 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ |
194 -Dflys.backend.user=$USER \ | 194 -Dflys.backend.user=$DBUSER \ |
195 -Dflys.backend.password=$PASS \ | 195 -Dflys.backend.password=$DBPASS \ |
196 -Dflys.backend.url=$BACKEND_URL \ | 196 -Dflys.backend.url=$BACKEND_URL \ |
197 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ | 197 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ |
198 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ | 198 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ |
199 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ | 199 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ |
200 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ | 200 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ |
234 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties | 234 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties |
235 java -jar \ | 235 java -jar \ |
236 -Xmx$MIN_MEMORY \ | 236 -Xmx$MIN_MEMORY \ |
237 -server \ | 237 -server \ |
238 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ | 238 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ |
239 -Dflys.backend.user=$USER \ | 239 -Dflys.backend.user=$DBUSER \ |
240 -Dflys.backend.password=$PASS \ | 240 -Dflys.backend.password=$DBPASS \ |
241 -Dflys.backend.url=$BACKEND_URL \ | 241 -Dflys.backend.url=$BACKEND_URL \ |
242 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ | 242 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ |
243 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ | 243 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ |
244 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ | 244 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ |
245 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ | 245 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ |
279 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties | 279 sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties |
280 java -jar \ | 280 java -jar \ |
281 -Xmx$MIN_MEMORY \ | 281 -Xmx$MIN_MEMORY \ |
282 -server \ | 282 -server \ |
283 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ | 283 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ |
284 -Dflys.backend.user=$USER \ | 284 -Dflys.backend.user=$DBUSER \ |
285 -Dflys.backend.password=$PASS \ | 285 -Dflys.backend.password=$DBPASS \ |
286 -Dflys.backend.url=$BACKEND_URL \ | 286 -Dflys.backend.url=$BACKEND_URL \ |
287 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ | 287 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ |
288 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ | 288 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ |
289 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ | 289 -Dflys.backend.importer.infogew.file="$GEW_FILE" \ |
290 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ | 290 -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ |
328 | 328 |
329 exec python $(dirname $0)/geodaesie/shpimporter.py \ | 329 exec python $(dirname $0)/geodaesie/shpimporter.py \ |
330 --directory $RIVER_PATH \ | 330 --directory $RIVER_PATH \ |
331 --river_name $RIVER_NAME \ | 331 --river_name $RIVER_NAME \ |
332 --ogr_connection "$OGR_CONNECTION" \ | 332 --ogr_connection "$OGR_CONNECTION" \ |
333 --host $HOST \ | 333 --host $DBHOST \ |
334 --user $USER \ | 334 --user $DBUSER \ |
335 --password $PASS \ | 335 --password $DBPASS \ |
336 --verbose 1 \ | 336 --verbose 1 \ |
337 > "$LOG_FILE" 2>&1 | 337 > "$LOG_FILE" 2>&1 |
338 } | 338 } |
339 | 339 |
340 | 340 |