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 2010/10/21 08:05:54 UTC

svn commit: r1025840 - in /geronimo/server/trunk/framework: configs/karaf-framework/src/main/distribution/unix-shell/bin/ configs/karaf-framework/src/main/distribution/windows-text/bin/ modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/...

Author: genspring
Date: Thu Oct 21 06:05:53 2010
New Revision: 1025840

URL: http://svn.apache.org/viewvc?rev=1025840&view=rev
Log:
GERONIMO-5527 provide a way to clean osgi bundle cache when starting the server.

Modified:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo?rev=1025840&r1=1025839&r2=1025840&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo Thu Oct 21 06:05:53 2010
@@ -433,20 +433,22 @@ else
   echo "  stop --force      Stop Geronimo (followed by kill -KILL)"
   echo ""
   echo "args for debug, jpda run, jpda start, run and start commands:"
-  echo "       --quiet       No startup progress"
-  echo "       --long        Long startup progress"
-  echo "  -v   --verbose     INFO log level"
-  echo "  -vv  --veryverbose DEBUG log level"
-  echo "       --override    Override configurations. USE WITH CAUTION!"
-  echo "       --help        Detailed help."
-  echo "  -s   --secure      Enable Geronimo for 2 way secure JMX communication."
+  echo "  -q     --quiet           No startup progress
+  echo "  -l     --long            Long startup progress
+  echo "  -c     --clean           Clean osgi bundle cache
+  echo "  -v     --verbose         INFO log level
+  echo "  -vv    --veryverbose     DEBUG log level
+  echo "  -vvv   --veryveryverbose Trace log level
+  echo "  -o     --override        Override configurations. USE WITH CAUTION!
+  echo "  -h     --help            Detailed help.
+  echo "  -s     --secure          Enable Geronimo for 2 way secure JMX communication.
   echo ""
   echo "args for stop command:"
-  echo "       --user        Admin user"
-  echo "       --password    Admin password"
-  echo "       --host        Hostname of the server"
-  echo "       --port        RMI port to connect to"
-  echo "       --secure      Enable secure JMX communication"
+  echo "   -u     --user          Admin user
+  echo "   -p     --password      Admin password
+  echo "          --host          Hostname of the server
+  echo "          --port          RMI port to connect to
+  echo "          --secure        Enable secure JMX communication
   exit 1
 
 fi

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat?rev=1025840&r1=1025839&r2=1025840&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat Thu Oct 21 06:05:53 2010
@@ -249,20 +249,22 @@ echo   start             Start Geronimo 
 echo   stop              Stop Geronimo
 echo.
 echo args for debug, jpda run, jpda start, run and start commands:
-echo        --quiet       No startup progress
-echo        --long        Long startup progress
-echo   -v   --verbose     INFO log level
-echo   -vv  --veryverbose DEBUG log level
-echo        --override    Override configurations. USE WITH CAUTION!
-echo        --help        Detailed help.
-echo   -s   --secure      Enable Geronimo for 2 way secure JMX communication.
+echo   -q     --quiet           No startup progress
+echo   -l     --long            Long startup progress
+echo   -c     --clean           Clean osgi bundle cache
+echo   -v     --verbose         INFO log level
+echo   -vv    --veryverbose     DEBUG log level
+echo   -vvv   --veryveryverbose Trace log level
+echo   -o     --override        Override configurations. USE WITH CAUTION!
+echo   -h     --help            Detailed help.
+echo   -s     --secure          Enable Geronimo for 2 way secure JMX communication.
 echo.
 echo args for stop command:
-echo        --user        Admin user
-echo        --password    Admin password
-echo        --host        Hostname of the server
-echo        --port        RMI port to connect to
-echo        --secure      Enable secure JMX communication
+echo   -u     --user            Admin user
+echo   -p     --password        Admin password
+echo          --host            Hostname of the server
+echo          --port            RMI port to connect to
+echo          --secure          Enable secure JMX communication
 cmd /c exit /b 1
 goto end
 

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java?rev=1025840&r1=1025839&r2=1025840&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java Thu Oct 21 06:05:53 2010
@@ -40,12 +40,21 @@ public class DaemonCLParser extends Base
 
     private final static String ARGUMENT_SECURE_SHORTFORM = "s";
     private final static String ARGUMENT_SECURE = "secure";
+    
+    private final static String ARGUMENT_CLEAN_CACHE_SHORTFORM = "c";
+    private final static String ARGUMENT_CLEAN_CACHE = "clean";    
+    
     public DaemonCLParser(OutputStream out) {
         super(out);
         addProgressOptions();
         addOverride();
         addSecure();
+        addCleanCache();
     }
+    
+    public boolean isCleanCache() {
+        return commandLine.hasOption(ARGUMENT_CLEAN_CACHE_SHORTFORM);
+    }       
 
     public boolean isSecure() {
         return commandLine.hasOption(ARGUMENT_SECURE_SHORTFORM);
@@ -90,6 +99,16 @@ public class DaemonCLParser extends Base
         options.addOption(ARGUMENT_SECURE_SHORTFORM, ARGUMENT_SECURE, false,
                 "Use secure channel to communicate with the server.  Unsecured channel is used by default.");
     }
+    
+    protected void addCleanCache() {
+
+        options.addOption(ARGUMENT_CLEAN_CACHE_SHORTFORM,
+                ARGUMENT_CLEAN_CACHE,
+                false,
+                "Delete cache folder. This is typically used when developer wants to pick up artifacts modification in repository");
+    }    
+    
+
 
     protected void addProgressOptions() {
         OptionGroup optionGroup = new OptionGroup();

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=1025840&r1=1025839&r2=1025840&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java Thu Oct 21 06:05:53 2010
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.system.main;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -39,6 +40,7 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.LifecycleMonitor;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.Main;
 import org.osgi.framework.Bundle;
 import org.slf4j.Logger;
@@ -71,7 +73,8 @@ public class EmbeddedDaemon implements M
             throw new IllegalArgumentException("Argument type is [" + opaque.getClass() + "]; expected [" + DaemonCLParser.class + "]");
         }
         DaemonCLParser parser = (DaemonCLParser) opaque;
-
+        
+        cleanCache(parser);
         initializeMonitor(parser);
         initializeOverride(parser);
         initializeSecure(parser);
@@ -129,6 +132,13 @@ 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);
+        }
+    }
 
     protected void initializeMonitor(DaemonCLParser parser) {
         if (parser.isVerboseInfo() || parser.isVerboseDebug() || parser.isVerboseTrace() || parser.isNoProgress()) {