Newer
Older
# This script reads and writes entries from a Chado database.
# Examples:
# writedb_entry -help
# writedb_entry -s Pf3D7_01 Pf3D7_05 Pf3D7_07
#
# If the environment variable ARTEMIS_JAVA_JRE points to a Java JRE
# then this JRE will be used in preference to any other.
“kpepper”
committed
#
PROXY_SETTINGS=
add_proxy_properties() {
if [[ "$http_proxy" = "" ]]
then
http_proxy=$HTTP_PROXY
fi
if [[ "$http_proxy" = "" ]]
then
http_proxy=$HTTP_proxy
fi
if [[ "$http_proxy" != "" ]]
then
PROXY_SETTINGS="${PROXY_SETTINGS} -DproxySet=true "`echo $http_proxy | sed 's/http:\/\/\(.*\):\(.*\)/ -Dhttp.proxyHost=\1 -Dhttp.proxyPort=\2/'`
fi
}
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname $PRG`/$link"
fi
#
# Allow URLs to work from behind firewalls.
#
add_proxy_properties
FLAGS="-mx2048m -ms20m -Djdbc.drivers=org.postgresql.Driver -Dibatis"
DEFAULT_CONNECTION="-Dchado=db.genedb.org:5432/snapshot?genedb_ro -Dread_only"
APPLICATION_HOME=`dirname "$PRG"`/..
JAR_NAME=artemis.jar
JAR_FILE_DEFAULT=$APPLICATION_HOME/target/jars/$JAR_NAME
JAR_FILE_INSTALLED=$APPLICATION_HOME/dist/$JAR_NAME
#
# Use a custom Java version if necessary
#
“kpepper”
committed
if [[ "$ARTEMIS_JAVA_JRE" = "" ]]
then
JAVA=`which java`
else
JAVA_HOME=$ARTEMIS_JAVA_JRE
JAVA=$ARTEMIS_JAVA_JRE/bin/java
fi
JAVA_VERSION=`${JAVA} -version 2>&1`
echo ${JAVA_VERSION}
while test $# != 0
do
case $1 in
-Dchado*)
DEFAULT_CONNECTION="$1" ;;
FLAGS="$FLAGS $1" ;;
*) break ;;
esac
shift
done
# searches for the -c option (needs to know the index)
idx=0
for arg in "$@"
do
if [ '-c' == "${arg}" ]; then
let "nextID = $idx + 1";
if [[ "$QUIET" = "no" ]]
then
echo "Starting writedb_entry with arguments: $PROXY_SETTINGS $DEFAULT_CONNECTION $FLAGS $@"
fi
$JAVA $PROXY_SETTINGS $DEFAULT_CONNECTION $FLAGS -cp "$APPLICATION_HOME:$JAR_FILE_DEFAULT:$JAR_FILE_INSTALLED" uk.ac.sanger.artemis.io.ReadAndWriteEntry "$@"