From 160c254e65e1259bffdb20a8cc1c82f156d3b225 Mon Sep 17 00:00:00 2001
From: Alan Beccati <beccati@rasdaman.com>
Date: Fri, 30 Aug 2013 11:31:02 +0200
Subject: [PATCH] ticket:468 Enable init_wms with connect file parameter
---
.../rasgeo/wms-import/utilities/init_wms.sh | 47 +++++++++++++++++---
1 file changed, 42 insertions(+), 5 deletions(-)
mode change 100644 => 100755 applications/rasgeo/wms-import/utilities/add_wms_service.sh
mode change 100644 => 100755 applications/rasgeo/wms-import/utilities/drop_wms.sh
mode change 100644 => 100755 applications/rasgeo/wms-import/utilities/fill_pyramid.sh
mode change 100644 => 100755 applications/rasgeo/wms-import/utilities/init_wms.sh
diff --git a/applications/rasgeo/wms-import/utilities/add_wms_service.sh b/applications/rasgeo/wms-import/utilities/add_wms_service.sh
old mode 100644
new mode 100755
diff --git a/applications/rasgeo/wms-import/utilities/drop_wms.sh b/applications/rasgeo/wms-import/utilities/drop_wms.sh
old mode 100644
new mode 100755
diff --git a/applications/rasgeo/wms-import/utilities/fill_pyramid.sh b/applications/rasgeo/wms-import/utilities/fill_pyramid.sh
old mode 100644
new mode 100755
diff --git a/applications/rasgeo/wms-import/utilities/init_wms.sh b/applications/rasgeo/wms-import/utilities/init_wms.sh
old mode 100644
new mode 100755
index caa7ae0..a5996a8
a
|
b
|
|
33 | 33 | PYRAMID_ARG='-l' |
34 | 34 | HOST_ARG='-h' |
35 | 35 | PORT_ARG='-p' |
| 36 | CONNFILE_ARG='-c' |
36 | 37 | ME="$( basename $0 )" |
37 | 38 | USAGE=" |
38 | | usage: $ME <layerName> <collName> <crs> [$PYRAMID_ARG <pyramidLevels>] [$HOST_ARG <host>] [$PORT_ARG <port>] |
| 39 | usage: $ME <layerName> <collName> <crs> [$PYRAMID_ARG <pyramidLevels>] [$HOST_ARG <host>] [$PORT_ARG <port>] [$CONNFILE_ARG <path_to_rasconnect>] |
39 | 40 | where |
40 | 41 | <layerName> the arbitrary name for the /new/ WMS layer; |
41 | 42 | <collName> must be an existing collection in rasdaman (but not already a published WMS coverage); |
… |
… |
|
45 | 46 | <host:port> of the WMS (->Petascope): important for for pluggin the WMS service into client softwares [default localhost:8080]. |
46 | 47 | Argument are considered if this is the first WMS layer that is added, |
47 | 48 | hence no WMS service has previously been defined. |
| 49 | <path_to_rasconnect> metadata db connection info (see ./rasgeo/README), |
| 50 | defaults to $HOME/.rasdaman/rasconnect |
48 | 51 | " |
49 | 52 | # In case the usage changes, consequently adjust these values: |
50 | 53 | MIN_ARGS=3 |
51 | | MAX_ARGS=9 |
| 54 | MAX_ARGS=11 |
52 | 55 | # |
53 | 56 | # DESCRIPTION |
54 | 57 | # Given an existing 2D coverage in rasdaman, the script fetches its metadata |
… |
… |
|
76 | 79 | # 2008-may-02 P.Baumann metadata now in database |
77 | 80 | # 2012-jun-01 pcampalani Backporting for Petascope: automatic fetch of collection metadata |
78 | 81 | # and petascopedb sync. |
| 82 | # 2013-aug-29 A.Beccati connection file as a parameter to allow calling script from other user context or from a web server profile |
79 | 83 | # |
80 | 84 | # TODO: |
81 | 85 | # - add option to cutomize the style: currently the layer are limited to RGB and Grey sets, "as is". |
… |
… |
|
87 | 91 | # --- DEFAULTS ------------------------------------------------------ |
88 | 92 | # --- values here can (and should) be adjusted to local choices ----- |
89 | 93 | |
90 | | # user / password for logging in to rasdaman |
91 | 94 | # (defined here so that they do not appear in command line) |
92 | | USER=rasadmin |
| 95 | # Added also to dbconnect file so that no hardcoded values are used |
| 96 | # TODO: keeping them initialized here for backward compatibility, |
| 97 | # remove from there (they'll be overwritten by connect file) as soon as |
| 98 | # new connect file is deployed officially (might require migration, |
| 99 | # warning already added) |
| 100 | USER=rasadmin |
93 | 101 | PASSWD=rasadmin |
94 | 102 | |
95 | 103 | # script directory |
… |
… |
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
102 | 110 | HOST_KEY=host |
103 | 111 | PGPORT_KEY=pgport |
104 | 112 | RASDBNAME_KEY=rasdbname |
| 113 | RASUSER_KEY=rasuser # user for RASBASE (not used here) |
| 114 | RASPASSWD_KEY=raspassword # user password for RASBASE (not used here) |
| 115 | USER_KEY=rasloginuser # user for logging in to rasdaman |
| 116 | PASSWD_KEY=rasloginpassword # password for logging in to rasdaman |
105 | 117 | PETADBNAME_KEY=petadbname |
106 | 118 | PETAUSER_KEY=petauser |
107 | 119 | PETAPASSWD_KEY=petapassword |
… |
… |
while [ $# -gt 0 ]; do
|
309 | 321 | $PYRAMID_ARG) LEVELS_STRING="$2"; shift;; |
310 | 322 | $HOST_ARG) PETASCOPE_HOST="$2"; shift;; |
311 | 323 | $PORT_ARG) PETASCOPE_PORT="$2"; shift;; |
| 324 | $CONNFILE_ARG) CONNECT_FILE="$2" ; shift;; |
312 | 325 | esac |
313 | 326 | shift |
314 | 327 | done |
… |
… |
fi
|
324 | 337 | RAS_HOST=$(cat $CONNECT_FILE | grep $HOST_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
325 | 338 | PG_PORT=$(cat $CONNECT_FILE | grep $PGPORT_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
326 | 339 | RASDB_NAME=$(cat $CONNECT_FILE | grep $RASDBNAME_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
327 | | PETADB_NAME="$(cat $CONNECT_FILE | grep $PETADBNAME_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }')" |
| 340 | RASUSER=$(cat $CONNECT_FILE | grep $RASUSER_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
| 341 | RASPASSWD=$(cat $CONNECT_FILE | grep $RASPASSWD_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
| 342 | |
| 343 | #TODO: remove check and defaults after deprecation of old format, rename without T |
| 344 | TUSER=$(cat $CONNECT_FILE | grep $USER_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
| 345 | TPASSWD=$(cat $CONNECT_FILE | grep $PASSWD_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
| 346 | |
| 347 | #TODO: remove check and defaults after deprecation of old format |
| 348 | if [ -z "$TUSER" ] ; then |
| 349 | echo "$ME: WARNING: Parameter $USER_KEY missing from connect file: $CONNECT_FILE , please update it!" |
| 350 | echo "$ME: Using default $USER_KEY = $USER" |
| 351 | else |
| 352 | USER="$TUSER" |
| 353 | fi |
| 354 | |
| 355 | #TODO: remove check and defaults after deprecation of old format |
| 356 | if [ -z "$TPASSWD" ] ; then |
| 357 | echo "$ME: WARNING: Parameter $PASSWD_KEY missing from connect file: $CONNECT_FILE , please update it!" |
| 358 | echo "$ME: Using default $PASSWD_KEY = $PASSWD" |
| 359 | else |
| 360 | PASSWD="$TPASSWD" |
| 361 | fi |
| 362 | |
| 363 | |
| 364 | PETADB_NAME="$(cat $CONNECT_FILE | grep $PETADBNAME_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }')" |
328 | 365 | PETAUSER=$(cat $CONNECT_FILE | grep $PETAUSER_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
329 | 366 | PETAPASSWD=$(cat $CONNECT_FILE | grep $PETAPASSWD_KEY | "$AWK" 'BEGIN { FS="=" }; { print $2 }') |
330 | 367 | |