customizable classpath v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 03 Jan 2014 00:27:16 +0100
branchv_0
changeset 1220c284726a77d
parent 121 53a331cbc7b4
child 123 248a98c13ca4
customizable classpath
scripts/sql-dk.sh
     1.1 --- a/scripts/sql-dk.sh	Thu Jan 02 21:26:50 2014 +0100
     1.2 +++ b/scripts/sql-dk.sh	Fri Jan 03 00:27:16 2014 +0100
     1.3 @@ -1,20 +1,38 @@
     1.4  #!/bin/bash
     1.5  
     1.6 +# include user-defined overrides and customization
     1.7  if [ -f ~/.sql-dk/environment.sh ]; then # .sql-dk must match with DIR in Constants.java
     1.8      . ~/.sql-dk/environment.sh
     1.9  fi
    1.10  
    1.11 +# link/copy support files for configuration
    1.12  [ -f ~/.sql-dk/config.xsd ] || ln -s /usr/share/doc/sql-dk/config.xsd ~/.sql-dk/config.xsd
    1.13  [ -f ~/.sql-dk/config.rnc ] || ln -s /usr/share/doc/sql-dk/config.rnc ~/.sql-dk/config.rnc
    1.14  [ -f ~/.sql-dk/config.xsl ] || cp /usr/share/doc/sql-dk/config.xsl ~/.sql-dk/config.xsl # might not work in www browser if just symlinked
    1.15  
    1.16 +
    1.17 +# Standard JDBC drivers
    1.18 +[ -n "$STANDARD_JDBC" ] || STANDARD_JDBC=(
    1.19 +	"/usr/share/java/postgresql-jdbc4.jar"
    1.20 +	"/usr/share/java/mysql.jar"
    1.21 +);
    1.22 +
    1.23 +# Additional JDBC drivers might be specified in CUSTOM_JDBC array
    1.24 +# Plugins (formatters etc.) might be specified in PLUGINS array
    1.25 +
    1.26 +# JAR containing SQL-DK application
    1.27  [ -n "$JAR" ] || JAR="/usr/share/sql-dk/sql-dk.jar";
    1.28  
    1.29 +CLASS_PATH="$JAR";
    1.30 +
    1.31 +for e in "${STANDARD_JDBC[@]}" "${CUSTOM_JDBC[@]}" "${PLUGINS[@]}"; do
    1.32 +	CLASS_PATH="$CLASS_PATH:$e";
    1.33 +done
    1.34 +
    1.35 +
    1.36  MAIN_CLASS="info.globalcode.sql.dk.CLIStarter";
    1.37 -CLASSPATH="$JAR:/usr/share/java/postgresql-jdbc4.jar";
    1.38  
    1.39  LOGGER="-Djava.util.logging.config.class=info.globalcode.sql.dk.logging.LoggerInitializer";
    1.40 -# LOG_LEVEL="FINE"; # SEVERE, WARNING, INFO, FINE, FINER, FINEST, ALL
    1.41  [ -n "$LOG_LEVEL" ] && LOGGER_LEVEL="-Dinfo.globalcode.sql.dk.logging.LoggerInitializer.level=$LOG_LEVEL";
    1.42  
    1.43 -java $LOGGER $LOGGER_LEVEL -cp $CLASSPATH $MAIN_CLASS "$@"
    1.44 +java $LOGGER $LOGGER_LEVEL -cp "$CLASS_PATH" $MAIN_CLASS "$@"