Revision: 16500
http://sourceforge.net/p/gate/code/16500
Author: johann_p
Date: 2013-02-03 15:29:58 +0000 (Sun, 03 Feb 2013)
Log Message:
-----------
Added command line option -dc DIR to specify a directory
with default config and session files for -ln and -ld and
option -tmp to use temporary configuration and session files
that get cleaned up after leaving GATE.
Modified Paths:
--------------
gate/trunk/bin/gate.sh
Modified: gate/trunk/bin/gate.sh
===================================================================
--- gate/trunk/bin/gate.sh 2013-02-03 02:19:22 UTC (rev 16499)
+++ gate/trunk/bin/gate.sh 2013-02-03 15:29:58 UTC (rev 16500)
@@ -42,6 +42,37 @@
vmparams=( "${vmparams[@]}" "-splash:$GATE_HOME/bin/splash.png" )
+DEFAULTSDIR=
+tmpbase="config_files_with_this_base_should_never_really_exist_so_we_can_test_for_existence_later"
+
+## function that copies over any config files that do not already exist
+## from the DEFAULTSDIR, if the DEFAULTSDIR has been specified
+## Expected parms: $1 is base name of config files to create
+copy_default_files() {
+ base=$1
+ echo copying default files base=$base
+ if [ -f "$CURDIR/$base.session" ]
+ then
+ echo using existing "$CURDIR/$base.session"
+ else
+ if [ -f "${DEFAULTSDIR}"/default.session ]
+ then
+ echo copying default session from "${DEFAULTSDIR}"/default.session to
"$CURDIR/$base.session"
+ cp "${DEFAULTSDIR}"/default.session "$CURDIR/$base.session"
+ fi
+ fi
+ if [ -f "$CURDIR/$base.xml" ]
+ then
+ echo using existing "$CURDIR/$base.xml"
+ else
+ if [ -f "${DEFAULTSDIR}"/default.xml ]
+ then
+ echo copying default config from "${DEFAULTSDIR}"/default.xml to
"$CURDIR/$base.xml"
+ cp "${DEFAULTSDIR}"/default.xml "$CURDIR/$base.xml"
+ fi
+ fi
+}
+
while test "$1" != "";
do
case "$1" in
@@ -56,9 +87,13 @@
-ll ... if the current directory contains a file log4j.properties use
this file to configure the logging
-rh path ... set the resources home path, this is a shortcut for
- -Druntime.gate.user.resourceshome=path
+ -Druntime.gate.user.resourceshome=path
-d URL ... register the plugin at URL. Can be used multiple times.
-i path ... use the file at path as the site configuration file
+ -dc dir ... copy default.xml and/or default.session from this dir when
+ creating a new config or session file
+ (must come before -ld,-ld,-tmp)
+ -tmp ... use temporary config and session files (-dc option works)
-h ... show this help
All other options will be passed on to the "java" command, for example:
-Djava.io.tmpdir=<somedir>
@@ -69,10 +104,11 @@
exit 0
;;
-ld)
+ shift
vmparams=( "${vmparams[@]}" "-Dgate.user.config=$CURDIR/.gate.xml" )
vmparams=( "${vmparams[@]}" "-Dgate.user.session=$CURDIR/.gate.session" )
vmparams=( "${vmparams[@]}" "-Dgate.user.filechooser.defaultdir=$CURDIR" )
- shift
+ copy_default_files ".gate"
;;
-ln)
shift
@@ -81,6 +117,7 @@
vmparams=( "${vmparams[@]}" "-Dgate.user.config=$CURDIR/$base.xml" )
vmparams=( "${vmparams[@]}" "-Dgate.user.session=$CURDIR/$base.session" )
vmparams=( "${vmparams[@]}" "-Dgate.user.filechooser.defaultdir=$CURDIR" )
+ copy_default_files "$base"
;;
-ll)
shift
@@ -106,6 +143,19 @@
gateparams=( "${gateparams[@]}" "-i" "$1" )
shift
;;
+ -tmp)
+ shift
+ tmpbase=GATE$$
+ vmparams=( "${vmparams[@]}" "-Dgate.user.config=$CURDIR/$tmpbase.xml" )
+ vmparams=( "${vmparams[@]}" "-Dgate.user.session=$CURDIR/$tmpbase.session"
)
+ vmparams=( "${vmparams[@]}" "-Dgate.user.filechooser.defaultdir=$CURDIR" )
+ copy_default_files "$tmpbase"
+ ;;
+ -dc)
+ shift
+ DEFAULTSDIR=$1
+ shift
+ ;;
*)
vmparams=( "${vmparams[@]}" "$1" )
shift
@@ -134,4 +184,14 @@
echo "Running GATE using Java at $JAVACMD"
echo "$JAVACMD" "${vmparams[@]}" -jar "$GATE_HOME/bin/gateLauncher.jar"
"${gateparams[@]}"
-exec "$JAVACMD" "${vmparams[@]}" -jar "$GATE_HOME/bin/gateLauncher.jar"
"${gateparams[@]}"
+"$JAVACMD" "${vmparams[@]}" -jar "$GATE_HOME/bin/gateLauncher.jar"
"${gateparams[@]}"
+
+## clean up temporary config files if -tmp had been specified
+if [ -f "$CURDIR"/"$tmpbase".xml ]
+then
+ rm "$CURDIR"/"$tmpbase".xml
+fi
+if [ -f "$CURDIR"/"$tmpbase".session ]
+then
+ rm "$CURDIR"/"$tmpbase".session
+fi
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs