You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ge...@apache.org on 2011/01/25 10:47:01 UTC
svn commit: r1063193 - in /geronimo/server/branches/3.0-M2/framework:
configs/karaf-framework/src/main/distribution/unix-shell/bin/
configs/karaf-framework/src/main/distribution/windows-text/bin/
modules/geronimo-system/src/main/java/org/apache/geronim...
Author: genspring
Date: Tue Jan 25 09:47:01 2011
New Revision: 1063193
URL: http://svn.apache.org/viewvc?rev=1063193&view=rev
Log:
GERONIMO-5527 Support -c/--clean option in the server startup script to clean cache for OSGi/tomcat
1, Levarage OSGi standard cache clean flag
2, Externalize other resources to clean to geronimo script.
Modified:
geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
geronimo/server/branches/3.0-M2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Modified: geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo?rev=1063193&r1=1063192&r2=1063193&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo (original)
+++ geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo Tue Jan 25 09:47:01 2011
@@ -293,6 +293,24 @@ if [ "$1" = "jpda" ] ; then
shift
fi
+processOptions() {
+ while [ "x$1" != "x" ]; do
+ case "$1" in
+ -c|--clean)
+ if [ -z "$OSGI_CACHE_CLEAN_ARGS" ]; then
+ OSGI_CACHE_CLEAN_ARGS="-Dorg.osgi.framework.storage.clean=onFirstInit"
+ fi
+ if [ -z "$CACHES_TO_CLEAN_STRING" ]; then
+ CACHES_TO_CLEAN_STRING="-Ddirectorys.to.remove.on.start=/var/catalina/work,/var/catalina/resources"
+ fi
+ ;;
+ esac
+ shift
+ done
+}
+
+processOptions "$@"
+
if [ "$1" = "debug" ] ; then
if $os400; then
echo "Debug command not available on OS400"
@@ -313,6 +331,8 @@ if [ "$1" = "debug" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
fi
@@ -330,6 +350,8 @@ elif [ "$1" = "run" ]; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
else
@@ -342,6 +364,8 @@ elif [ "$1" = "run" ]; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
fi
@@ -366,6 +390,8 @@ elif [ "$1" = "start" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
else
@@ -378,6 +404,8 @@ elif [ "$1" = "start" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
fi
@@ -394,6 +422,8 @@ elif [ "$1" = "start" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@" \
>> $GERONIMO_OUT 2>&1 &
@@ -412,6 +442,8 @@ elif [ "$1" = "start" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@" \
>> $GERONIMO_OUT 2>&1 &
@@ -443,6 +475,8 @@ elif [ "$1" = "stop" ] ; then
-Djava.endorsed.dirs="$ENDORSED_DIRS" \
-Djava.ext.dirs="$EXT_DIRS" \
-Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+ $OSGI_CACHE_CLEAN_ARGS \
+ $CACHES_TO_CLEAN_STRING \
-classpath "$CLASSPATH" \
org.apache.geronimo.cli.shutdown.ShutdownCLI "$@"
Modified: geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat?rev=1063193&r1=1063192&r2=1063193&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat (original)
+++ geronimo/server/branches/3.0-M2/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat Tue Jan 25 09:47:01 2011
@@ -318,9 +318,22 @@ goto execCmd
:execCmd
@REM Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
+
+
:setArgs
+set OSGI_CACHE_CLEAN_ARGS =
+set CACHES_TO_CLEAN_STRING =
+
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+
+set clean=false
+if ""%1""==""-c"" set clean=true
+if ""%1""==""--clean"" set clean=true
+if "%clean%"=="true" (
+ set OSGI_CACHE_CLEAN_ARGS=-Dorg.osgi.framework.storage.clean=onFirstInit
+ set CACHES_TO_CLEAN_STRING=-Ddirectorys.to.remove.on.start="/var/catalina/work,/var/catalina/resources"
+)
shift
goto setArgs
:doneSetArgs
@@ -335,11 +348,11 @@ cmd /c exit /b 0
@REM Execute Java with the applicable properties
if not "%JDB%" == "" goto doJDB
-%_EXECJAVA% %JAVA_OPTS% %GERONIMO_OPTS% %JAVA_AGENT_OPTS% %CONSOLE_OPTS% -Dorg.apache.geronimo.home.dir="%GERONIMO_HOME%" -Dkaraf.home="%GERONIMO_HOME%" -Dkaraf.base="%GERONIMO_HOME%" -Djava.util.logging.config.file="%GERONIMO_HOME%\etc\java.util.logging.properties" -Djava.endorsed.dirs="%GERONIMO_HOME%\lib\endorsed;%JRE_HOME%\lib\endorsed" -Djava.ext.dirs="%GERONIMO_HOME%\lib\ext;%JRE_HOME%\lib\ext" -Djava.io.tmpdir="%GERONIMO_TMPDIR%" -classpath "%CLASSPATH%" %MAINCLASS% %_LONG_OPT% %CMD_LINE_ARGS%
+%_EXECJAVA% %JAVA_OPTS% %GERONIMO_OPTS% %JAVA_AGENT_OPTS% %CONSOLE_OPTS% -Dorg.apache.geronimo.home.dir="%GERONIMO_HOME%" -Dkaraf.home="%GERONIMO_HOME%" -Dkaraf.base="%GERONIMO_HOME%" -Djava.util.logging.config.file="%GERONIMO_HOME%\etc\java.util.logging.properties" -Djava.endorsed.dirs="%GERONIMO_HOME%\lib\endorsed;%JRE_HOME%\lib\endorsed" -Djava.ext.dirs="%GERONIMO_HOME%\lib\ext;%JRE_HOME%\lib\ext" -Djava.io.tmpdir="%GERONIMO_TMPDIR%" %OSGI_CACHE_CLEAN_ARGS% %CACHES_TO_CLEAN_STRING% -classpath "%CLASSPATH%" %MAINCLASS% %_LONG_OPT% %CMD_LINE_ARGS%
goto end
:doJDB
-%_EXECJAVA% %JAVA_OPTS% %GERONIMO_OPTS% -sourcepath "%JDB_SRCPATH%" %CONSOLE_OPTS% -Dorg.apache.geronimo.home.dir="%GERONIMO_HOME%" -Dkaraf.home="%GERONIMO_HOME%" -Dkaraf.base="%GERONIMO_HOME%" -Djava.util.logging.config.file="%GERONIMO_HOME%\etc\java.util.logging.properties" -Djava.endorsed.dirs="%GERONIMO_HOME%\lib\endorsed;%JRE_HOME%\lib\endorsed" -Djava.ext.dirs="%GERONIMO_HOME%\lib\ext;%JRE_HOME%\lib\ext" -Djava.io.tmpdir="%GERONIMO_TMPDIR%" -classpath "%CLASSPATH%" %MAINCLASS% %CMD_LINE_ARGS%
+%_EXECJAVA% %JAVA_OPTS% %GERONIMO_OPTS% -sourcepath "%JDB_SRCPATH%" %CONSOLE_OPTS% -Dorg.apache.geronimo.home.dir="%GERONIMO_HOME%" -Dkaraf.home="%GERONIMO_HOME%" -Dkaraf.base="%GERONIMO_HOME%" -Djava.util.logging.config.file="%GERONIMO_HOME%\etc\java.util.logging.properties" -Djava.endorsed.dirs="%GERONIMO_HOME%\lib\endorsed;%JRE_HOME%\lib\endorsed" -Djava.ext.dirs="%GERONIMO_HOME%\lib\ext;%JRE_HOME%\lib\ext" -Djava.io.tmpdir="%GERONIMO_TMPDIR%" %OSGI_CACHE_CLEAN_ARGS% %CACHES_TO_CLEAN_STRING% -classpath "%CLASSPATH%" %MAINCLASS% %CMD_LINE_ARGS%
goto end
:end
Modified: geronimo/server/branches/3.0-M2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=1063193&r1=1063192&r2=1063193&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java (original)
+++ geronimo/server/branches/3.0-M2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java Tue Jan 25 09:47:01 2011
@@ -62,6 +62,13 @@ public class EmbeddedDaemon implements M
static String GERONIMO_HOME = "org.apache.geronimo.home.dir";
static String DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE = System.getProperty(GERONIMO_HOME)
+ "/var/config/config-substitutions.properties";
+ static String[] CACHES_TO_CLEAN;
+
+ static {
+
+ String CACHES_TO_CLEAN_STRING= System.getProperty("directorys.to.remove.on.start");
+ CACHES_TO_CLEAN = CACHES_TO_CLEAN_STRING.split(",");
+ }
public EmbeddedDaemon(Kernel kernel, Bundle bundle) {
this.kernel = kernel;
@@ -135,8 +142,10 @@ public class EmbeddedDaemon implements M
protected void cleanCache(DaemonCLParser parser) {
if (parser.isCleanCache()) {
- File cacheFolder = new File(System.getProperty(GERONIMO_HOME) + "/var/cache");
- FileUtils.recursiveDelete(cacheFolder);
+ for (String path:CACHES_TO_CLEAN){
+ File cacheFolder = new File(System.getProperty(GERONIMO_HOME) + path);
+ FileUtils.recursiveDelete(cacheFolder);
+ }
}
}