geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r883857 - in /geronimo/server/trunk/framework: configs/karaf-framework/src/main/distribution/unix-shell/bin/ configs/karaf-framework/src/main/distribution/windows-text/bin/ configs/karaf-framework/src/main/filtered-resources/etc/ configs/sh...
Date Tue, 24 Nov 2009 20:28:43 GMT
Author: gawor
Date: Tue Nov 24 20:28:41 2009
New Revision: 883857

URL: http://svn.apache.org/viewvc?rev=883857&view=rev
Log:
1) register geronimo-managed mbean server as osgi service, 2) enable osgi jmx bundle to expose rfc139 mbeans, 3) add/update the shutdown command to use rfc139 mbean to stop the container, 4) update the debug properties for jdb to use geronimo defaults

Added:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown
      - copied, changed from r883248, geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat
      - copied, changed from r883248, geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java   (with props)
Removed:
    geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/kernel/
Modified:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy
    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/client.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/config.properties
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
    geronimo/server/trunk/framework/configs/shutdown/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java
    geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/MainBridge.java

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client Tue Nov 24 20:28:41 2009
@@ -225,7 +225,7 @@
             CLASSPATH="$CLASSPATH:$file"
         fi
     done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
 
     ##
     ## TODO: Move to conf/profiler/yourkit.{sh|cmd}

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy Tue Nov 24 20:28:41 2009
@@ -225,7 +225,7 @@
             CLASSPATH="$CLASSPATH:$file"
         fi
     done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
 
     ##
     ## TODO: Move to conf/profiler/yourkit.{sh|cmd}

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=883857&r1=883856&r2=883857&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 Tue Nov 24 20:28:41 2009
@@ -225,7 +225,7 @@
             CLASSPATH="$CLASSPATH:$file"
         fi
     done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
 
     ##
     ## TODO: Move to conf/profiler/yourkit.{sh|cmd}

Copied: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown (from r883248, geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown?p2=geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown&p1=geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client&r1=883248&r2=883857&rev=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown Tue Nov 24 20:28:41 2009
@@ -225,7 +225,7 @@
             CLASSPATH="$CLASSPATH:$file"
         fi
     done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
 
     ##
     ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
@@ -285,7 +285,7 @@
         KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
         CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
     fi
-    exec $JAVA $JAVA_OPTS -Dorg.apache.geronimo.home.dir="$KARAF_HOME" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties $OPTS -classpath "$CLASSPATH" org.apache.geronimo.cli.client.ClientCLI "$@"
+    exec $JAVA $JAVA_OPTS -Dorg.apache.geronimo.home.dir="$KARAF_HOME" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties $OPTS -classpath "$CLASSPATH" org.apache.geronimo.cli.shutdown.ShutdownCLI "$@"
 }
 
 main() {

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat Tue Nov 24 20:28:41 2009
@@ -61,7 +61,7 @@
 set LOCAL_CLASSPATH=%CLASSPATH%
 set DEFAULT_JAVA_OPTS=-server -Xmx512M -Dderby.system.home="%KARAF_BASE%\data\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote
 set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf
-set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 
 if "%LOCAL_CLASSPATH%" == "" goto :KARAF_CLASSPATH_EMPTY
     set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat Tue Nov 24 20:28:41 2009
@@ -61,7 +61,7 @@
 set LOCAL_CLASSPATH=%CLASSPATH%
 set DEFAULT_JAVA_OPTS=-server -Xmx512M -Dderby.system.home="%KARAF_BASE%\data\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote
 set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf
-set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 
 if "%LOCAL_CLASSPATH%" == "" goto :KARAF_CLASSPATH_EMPTY
     set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf

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=883857&r1=883856&r2=883857&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 Tue Nov 24 20:28:41 2009
@@ -61,7 +61,7 @@
 set LOCAL_CLASSPATH=%CLASSPATH%
 set DEFAULT_JAVA_OPTS=-server -Xmx512M -Dderby.system.home="%KARAF_BASE%\data\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote
 set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf
-set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 
 if "%LOCAL_CLASSPATH%" == "" goto :KARAF_CLASSPATH_EMPTY
     set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf

Copied: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat (from r883248, geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat?p2=geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat&p1=geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat&r1=883248&r2=883857&rev=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat Tue Nov 24 20:28:41 2009
@@ -61,7 +61,7 @@
 set LOCAL_CLASSPATH=%CLASSPATH%
 set DEFAULT_JAVA_OPTS=-server -Xmx512M -Dderby.system.home="%KARAF_BASE%\data\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote
 set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf
-set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 
 if "%LOCAL_CLASSPATH%" == "" goto :KARAF_CLASSPATH_EMPTY
     set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf
@@ -152,7 +152,7 @@
     if "%SHIFT%" == "true" SET ARGS=%2 %3 %4 %5 %6 %7 %8
     if not "%SHIFT%" == "true" SET ARGS=%1 %2 %3 %4 %5 %6 %7 %8    
     rem Execute the Java Virtual Machine
-    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Dorg.apache.geronimo.home.dir="%KARAF_HOME%" -Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties" org.apache.geronimo.cli.client.ClientCLI %ARGS%
+    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Dorg.apache.geronimo.home.dir="%KARAF_HOME%" -Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties" org.apache.geronimo.cli.shutdown.ShutdownCLI %ARGS%
 
 rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/config.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/config.properties?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/config.properties (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/config.properties Tue Nov 24 20:28:41 2009
@@ -44,6 +44,7 @@
  org.apache.geronimo.main; version=${karaf.osgi.version}, \
  org.apache.geronimo.cli.daemon; version=${karaf.osgi.version}, \
  org.apache.geronimo.cli.client; version=${karaf.osgi.version}, \
+ org.apache.geronimo.cli.shutdown; version=${karaf.osgi.version}, \
  org.apache.geronimo.cli.deployer; version=${karaf.osgi.version}
 
 # javax.transaction is needed to avoid class loader constraint violation when using javax.sql

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties Tue Nov 24 20:28:41 2009
@@ -58,7 +58,7 @@
 #org/apache/felix/karaf/features/org.apache.felix.karaf.features.management/${felix.karaf.version}/org.apache.felix.karaf.features.management-${felix.karaf.version}.jar=30
 
 #org/apache/felix/karaf/org.apache.felix.karaf.management/${felix.karaf.version}/org.apache.felix.karaf.management-${felix.karaf.version}.jar=30
-#org/osgi/org.osgi.impl.bundle.jmx/${osgi.jmx.version}/org.osgi.impl.bundle.jmx-${osgi.jmx.version}.jar=30
+org/osgi/org.osgi.impl.bundle.jmx/${osgi.jmx.version}/org.osgi.impl.bundle.jmx-${osgi.jmx.version}.jar=30
 
 org/apache/mina/mina-core/${mina.version}/mina-core-${mina.version}.jar=30
 org/apache/sshd/sshd-core/${sshd.version}/sshd-core-${sshd.version}.jar=30

Modified: geronimo/server/trunk/framework/configs/shutdown/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/shutdown/pom.xml?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/shutdown/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/shutdown/pom.xml Tue Nov 24 20:28:41 2009
@@ -82,6 +82,7 @@
                 <groupId>org.apache.geronimo.buildsupport</groupId>
                 <artifactId>car-maven-plugin</artifactId>
                 <configuration>
+                    <boot>true</boot>
                     <archive>
                         <manifestEntries>
                             <Endorsed-Dirs>lib/endorsed</Endorsed-Dirs>
@@ -133,7 +134,7 @@
                     </classpath>
                     <classpathPrefix>../lib</classpathPrefix>
                     <category>Geronimo Core</category>
-\                    <instance>
+                    <instance>
                         <plugin-artifact>
                             <config-xml-content load="false" />
                         </plugin-artifact>

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java Tue Nov 24 20:28:41 2009
@@ -22,6 +22,7 @@
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
 import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
@@ -132,4 +133,11 @@
         options.addOptionGroup(optionGroup);
     }
 
+    protected void addOptionWithParam(String longOption, String shortOption, String argName, String desc) {
+        OptionBuilder optionBuilder = OptionBuilder.hasArg().withArgName(argName);
+        optionBuilder = optionBuilder.withLongOpt(longOption);
+        optionBuilder = optionBuilder.withDescription(desc);
+        Option option = optionBuilder.create(shortOption);
+        options.addOption(option);
+    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java Tue Nov 24 20:28:41 2009
@@ -47,7 +47,7 @@
         Bootstrapper boot = super.createBootstrapper();
         boot.setWaitForStop(false);
         boot.setUniqueStorage(true);
-        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/client-system/3.0-SNAPSHOT/car"));
+        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/client-system//car"));
         boot.setLog4jConfigFile("var/log/client-log4j.properties");
         return boot;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java Tue Nov 24 20:28:41 2009
@@ -46,7 +46,7 @@
     protected Bootstrapper createBootstrapper() {
         Bootstrapper boot = super.createBootstrapper();
         boot.setWaitForStop(true);
-        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/j2ee-system/3.0-SNAPSHOT/car"));
+        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/j2ee-system//car"));
         boot.setLog4jConfigFile("var/log/server-log4j.properties");
         return boot;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java Tue Nov 24 20:28:41 2009
@@ -57,7 +57,7 @@
         Bootstrapper boot = super.createBootstrapper();
         boot.setWaitForStop(false);
         boot.setUniqueStorage(true);
-        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/online-deployer/3.0-SNAPSHOT/car"));
+        boot.setStartBundles(Arrays.asList("org.apache.geronimo.framework/online-deployer//car"));
         boot.setLog4jConfigFile("var/log/deployer-log4j.properties");
         return boot;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java Tue Nov 24 20:28:41 2009
@@ -363,12 +363,4 @@
                         + "deployer:geronimo:jmx[://host[:port]] (though you could also just use --host and --port instead).");
     }
 
-    protected void addOptionWithParam(String longOption, String shortOption, String argName, String desc) {
-        OptionBuilder optionBuilder = OptionBuilder.hasArg().withArgName(argName);
-        optionBuilder = optionBuilder.withLongOpt(longOption);
-        optionBuilder = optionBuilder.withDescription(desc);
-        Option option = optionBuilder.create(shortOption);
-        options.addOption(option);
-    }
-
 }

Added: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java?rev=883857&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java Tue Nov 24 20:28:41 2009
@@ -0,0 +1,63 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.shutdown;
+
+import java.util.Arrays;
+
+import org.apache.geronimo.cli.AbstractCLI;
+import org.apache.geronimo.cli.CLParser;
+import org.apache.geronimo.main.Bootstrapper;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ShutdownCLI extends AbstractCLI {
+
+    public static void main(String[] args) {
+        int status = new ShutdownCLI(args).executeMain();
+        System.exit(status);
+    }
+
+    protected ShutdownCLI(String[] args) {
+        super(args, System.err);
+    }
+    
+    @Override
+    protected CLParser getCLParser() {
+        return new ShutdownCLParser(System.out);
+    }
+    
+    @Override
+    protected Bootstrapper createBootstrapper() {
+        Bootstrapper boot = super.createBootstrapper();
+        boot.setWaitForStop(false);
+        boot.setUniqueStorage(true);
+        boot.setStartBundles(Arrays.asList(
+                "org.apache.servicemix.bundles/org.apache.servicemix.bundles.jline//jar",
+                "org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant//jar",
+                "org.apache.geronimo.specs/geronimo-javaee-deployment_1.1MR3_spec//jar",
+                "org.apache.geronimo.framework/geronimo-deploy-config//jar",
+                "org.apache.geronimo.framework/geronimo-plugin//jar",
+                "org.apache.geronimo.framework/geronimo-deploy-jsr88//jar",
+                "org.apache.geronimo.framework/geronimo-deploy-tool//jar",                                
+                "org.apache.geronimo.framework/shutdown//car"));
+        boot.setLog4jConfigFile("var/log/server-log4j.properties");
+        return boot;
+    }
+
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLI.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java?rev=883857&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java Tue Nov 24 20:28:41 2009
@@ -0,0 +1,121 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.shutdown;
+
+import java.io.OutputStream;
+
+import org.apache.geronimo.cli.BaseCLParser;
+import org.apache.geronimo.cli.PrintHelper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ShutdownCLParser extends BaseCLParser {
+    
+    private final static String ARGUMENT_HOST_SHORTFORM = "host";
+    
+    private final static String ARGUMENT_PORT_SHORTFORM = "port";
+    private final static String ARGUMENT_PORT = "port";
+    
+    private final static String ARGUMENT_USER_SHORTFORM = "u";
+    private final static String ARGUMENT_USER = "user";
+
+    private final static String ARGUMENT_PASSWORD_SHORTFORM = "p";
+    private final static String ARGUMENT_PASSWORD = "password";
+    
+    private final static String ARGUMENT_SECURE_SHORTFORM = "secure";
+    private final static String ARGUMENT_SECURE = "secure";
+    
+    public ShutdownCLParser(OutputStream out) {
+        super(out);
+        
+        addHost();
+        addPort();
+        addUser();
+        addPassword();
+        addSecure();
+    }
+
+    public String getHost() {
+        return commandLine.getOptionValue(ARGUMENT_HOST_SHORTFORM);
+    }
+    
+    public Integer getPort() {
+        String port = commandLine.getOptionValue(ARGUMENT_PORT_SHORTFORM);
+        if (null == port) {
+            return null;
+        }
+        return new Integer(port);
+    }
+    
+    public String getUser() {
+        return commandLine.getOptionValue(ARGUMENT_USER_SHORTFORM);
+    }
+    
+    public String getPassword() {
+        return commandLine.getOptionValue(ARGUMENT_PASSWORD_SHORTFORM);
+    }
+    
+    public boolean isSecure() {
+        return commandLine.hasOption(ARGUMENT_SECURE_SHORTFORM);
+    }    
+    
+    public void displayHelp() {
+        PrintHelper printHelper = new PrintHelper(System.out);
+        printHelper.printHelp("java -jar bin/shutdown.jar $options",
+                "\nThe following options are available:",
+                options,
+                "\n",
+                true);
+    }
+
+    protected void addSecure() {
+        options.addOption(ARGUMENT_SECURE_SHORTFORM,
+                ARGUMENT_SECURE,
+                false,
+                "Use secure channel to communicate with the server.  Unsecured channel is used by default.");
+    }
+    
+    protected void addPassword() {
+        addOptionWithParam(ARGUMENT_PASSWORD,
+                ARGUMENT_PASSWORD_SHORTFORM,
+                "password",
+                "Specifies a password to use to authenticate to the server.");
+    }
+
+    protected void addUser() {
+        addOptionWithParam(ARGUMENT_USER,
+                ARGUMENT_USER_SHORTFORM,
+                "username",
+                "Specifies a username to use to authenticate to the server.");
+    }
+    
+    protected void addPort() {
+        addOptionWithParam(ARGUMENT_PORT,
+                ARGUMENT_PORT_SHORTFORM,
+                "port",
+                "The RMI port of a Geronimo server to stop.");
+    }
+
+    protected void addHost() {
+        addOptionWithParam(ARGUMENT_HOST_SHORTFORM,
+                ARGUMENT_HOST_SHORTFORM,
+                "hostname",
+                "The host name of a Geronimo server to stop.");                        
+    }
+    
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/shutdown/ShutdownCLParser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java Tue Nov 24 20:28:41 2009
@@ -18,80 +18,70 @@
 package org.apache.geronimo.deployment.cli;
 
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Map;
+import java.util.Set;
 
 import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 import javax.management.remote.rmi.RMIConnectorServer;
 import javax.rmi.ssl.SslRMIClientSocketFactory;
 
+import org.apache.geronimo.cli.shutdown.ShutdownCLParser;
 import org.apache.geronimo.deployment.cli.DeployUtils.SavedAuthentication;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.util.Main;
-import org.apache.geronimo.system.jmx.KernelDelegate;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.main.Main;
+import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
  */
-public class StopServer implements Main {
-
-	public static final String RMI_NAMING_CONFG_ID = "org/apache/geronimo/RMINaming";
+public class StopServer implements Main, GBeanLifecycle {
 
 	public static final String DEFAULT_PORT = "1099"; // 1099 is used by java.rmi.registry.Registry
 
-	String host;
-	
-	String port;
-
-	String user;
-
-	String password;
-	
-	boolean secure = false;
-
-	private String[] args;
-
-	public static void main(String[] args) throws Exception {
-		StopServer cmd = new StopServer();
-		cmd.execute(args);
-	}
-    
-    public int execute(Object opaque) {
-        if (! (opaque instanceof String[])) {
-            throw new IllegalArgumentException("Argument type is [" + opaque.getClass() + "]; expected [" + String[].class + "]");
-        }
-        this.args = (String[]) opaque;
+	private String host;	
+	private Integer port;
+	private String user;
+	private String password;	
+	private boolean secure;
 
-        int i = 0;
-        while (i < args.length && args[i].startsWith("--")) {
-            if (setParam(i++)) {
-                i++;
-            }
-        }
-
-        if (i < args.length) {
-            // There was an argument error somewhere.
-            printUsage();
-        }
+    private final Bundle bundle;
 
-        Integer portI = null;        
-        if (port != null) {
-            try {
-                portI = new Integer(port);
-            } catch (NumberFormatException e) {
-                System.out.println("Invalid port number specified.");
-                return 1;
-            }
+    public StopServer(Bundle bundle) {
+        this.bundle = bundle;
+    }
+    
+    public int execute(Object opaque) {
+        if (! (opaque instanceof ShutdownCLParser)) {
+            throw new IllegalArgumentException("Argument type is [" + opaque.getClass() + "]; expected [" + ShutdownCLParser.class + "]");
         }
+        ShutdownCLParser parser = (ShutdownCLParser) opaque;
 
+        port = parser.getPort();
+        if (port == null) {
+            port = new Integer(DEFAULT_PORT);
+        }
+        
+        host = parser.getHost();
+        if (host == null) {
+            host = "localhost";
+        }
+
+        secure = parser.isSecure();
+        
+        user = parser.getUser();
+        
+        password = parser.getPassword();
+        
         if (user == null && password == null) {
-            String uri = DeployUtils.getConnectionURI(host, portI, secure);
+            String uri = DeployUtils.getConnectionURI(host, port, secure);
             try {
                 SavedAuthentication savedAuthentication = DeployUtils.readSavedCredentials(uri);
                 if (savedAuthentication != null) {
@@ -117,106 +107,66 @@
                 return 1;
             }
         }
-
+        
+        System.out.print("Locating server on " + host + ":" + port + "... ");
+        MBeanServerConnection conn = null;
         try {
-            if (port == null) {
-                port = DEFAULT_PORT;
-            }
-            if (host == null) {
-                host = "localhost";
-            }
-            System.out.print("Locating server on " + host + ":" + port + "... ");
-            Kernel kernel = null;
-            try {
-                kernel = getRunningKernel();
-            } catch (IOException e) {
-                System.out.println();
-                System.out.println("Could not communicate with the server.  The server may not be running or the port number may be incorrect (" + e.getMessage() + ")");
-            }
-            if (kernel != null) {
-                System.out.println("Server found.");
-                System.out.println("Server shutdown started");
-                kernel.shutdown();
-                System.out.println("Server shutdown completed");
-            }
+            conn = getMBeanServerConnection();
         } catch (Exception e) {
-            e.printStackTrace();
+            System.err.println("Could not communicate with the server.  The server may not be running or the port number may be incorrect (" + e.getMessage() + ")");
             return 1;
         }
+        if (conn != null) {
+            System.out.println("Server found.");            
+            try {
+                shutdown(conn);
+            } catch (Exception e) {
+                System.err.println("Error shutting down the server");
+                e.printStackTrace();
+                return 2;
+            }            
+        }
         return 0;
     }
 
-	private boolean argumentHasValue(int i) {
-		return i + 1 < args.length && !args[i + 1].startsWith("--");
-	}
-
-	private boolean setParam(int i) {
-		if (argumentHasValue(i)) {
-			if (args[i].equals("--user")) {
-				user = args[++i];
-			} else if (args[i].equals("--password")) {
-				password = args[++i];
-			} else if (args[i].equals("--port")) {
-				port = args[++i];
-            } else if (args[i].equals("--host")) {
-                host = args[++i];
-			} else {
-				printUsage();
-			}
-			return true;
-		} else if (args[i].equals("--secure")) {
-		    secure = true;
-		} else {
-			printUsage();
-		}
-		return false;
-	}
-
-	public Kernel getRunningKernel() throws IOException {
-		Map map = new HashMap();
-		map.put(JMXConnector.CREDENTIALS, new String[] { user, password });
+    public MBeanServerConnection getMBeanServerConnection() throws Exception {
+        Map map = new HashMap();
+        map.put(JMXConnector.CREDENTIALS, new String[] { user, password });
         String connectorName = "/JMXConnector";
         if (secure) {
             connectorName = "/JMXSecureConnector";
             SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
             map.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
         }
-		Kernel kernel = null;
-		try {
-			JMXServiceURL address = new JMXServiceURL(
-					"service:jmx:rmi:///jndi/rmi://" + host + ":" + port + connectorName);
-			JMXConnector jmxConnector = JMXConnectorFactory.connect(address, map);
-			MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
-			kernel = new KernelDelegate(mbServerConnection);
-		} catch (MalformedURLException e) {
-			e.printStackTrace();
-		}
-		return kernel;
-	}
-
-	public void printUsage() {
-		System.out.println();
-		System.out.println("Command-line shutdown syntax:");
-		System.out.println("    shutdown [options]");
-		System.out.println();
-		System.out.println("The available options are:");
-		System.out.println("    --user <username>");
-		System.out.println("    --password <password>");
-		System.out.println("    --host <hostname>");
-		System.out.println("    --port <port>");
-		System.out.println("    --secure");
-		System.exit(1);
-	}
+        JMXServiceURL address = new JMXServiceURL(
+                "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + connectorName);
+        JMXConnector jmxConnector = JMXConnectorFactory.connect(address, map);
+        return jmxConnector.getMBeanServerConnection();       
+    }
+    
+    public void shutdown(MBeanServerConnection mbServerConnection) throws Exception {			
+        Set<ObjectName> objectNameSet = 
+            mbServerConnection.queryNames(new ObjectName("osgi.core:type=framework,*"), null);
+        if (objectNameSet.isEmpty()) {
+            throw new Exception("Framework mbean not found");
+        } else if (objectNameSet.size() == 1) {
+            System.out.println("Server shutdown started");
+            mbServerConnection.invoke(objectNameSet.iterator().next(), "stopBundle", 
+                                      new Object[] { 0 }, new String[] { long.class.getName() });
+            System.out.println("Server shutdown completed");
+        } else {
+            throw new Exception("Found multiple framework mbeans");
+        }
+    }
 
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(StopServer.class, "StopServer");
-
+        infoBuilder.addAttribute("bundle", Bundle.class, false);
+        infoBuilder.setConstructor(new String[]{"bundle"});
         infoBuilder.addInterface(Main.class);
 
-//        infoBuilder.setConstructor(new String[0]);
-
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
 
@@ -224,4 +174,15 @@
         return GBEAN_INFO;
     }
 
+    public void doFail() {
+    }
+
+    public void doStart() throws Exception {
+        bundle.getBundleContext().registerService(Main.class.getName(), this, new Hashtable());
+    }
+
+    public void doStop() throws Exception {
+        // TODO: unregister Main service?
+    }
+    
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Tue Nov 24 20:28:41 2009
@@ -296,7 +296,9 @@
         try {
             String location = locateBundle(configurationId, monitor);
             Bundle bundle = bundleContext.installBundle(location);
-            bundle.start(Bundle.START_TRANSIENT);
+            if (bundle.getState() != Bundle.STARTING) {
+                bundle.start(Bundle.START_TRANSIENT);
+            }
             bundles.put(configurationId, bundle);
         } catch (Exception e) {
             monitor.finished();

Modified: geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java Tue Nov 24 20:28:41 2009
@@ -19,9 +19,12 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.List;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -38,6 +41,9 @@
     private boolean uniqueStorage = false;   
     private ServerInfo serverInfo;
     private String log4jFile;
+    
+    private Semaphore startSemaphore;
+    private Throwable startException;
 
     public Bootstrapper() {
     }
@@ -69,10 +75,25 @@
         karafMain.getFramework().getBundleContext().registerService(ServerInfo.class.getName(), serverInfo, null);
         
         if (bundles != null) {
+            startSemaphore = new Semaphore(0);
             StartLevelListener listener = new StartLevelListener(this);
-            listener.start();            
+            listener.start();    
+            
+            try {
+                if (!startSemaphore.tryAcquire(60, TimeUnit.SECONDS)) {
+                    return -1;
+                }
+            } catch (InterruptedException e) {
+                return -1;
+            }
+
+            if (startException != null) {
+                System.err.println("Error starting bundles: " + startException.getMessage());
+                startException.printStackTrace();
+                return -1;
+            }
         }
-        
+                
         Main geronimo_main = getMain();
         
         if (geronimo_main == null) {
@@ -177,41 +198,77 @@
             
     public void startLevelChanged(int startLevel) {
         if (startLevel == defaultStartLevel) {
-            startBundles();
+            try {
+                startBundles();
+                startException = null;
+            } catch (Throwable e) {
+                startException = e;
+            } finally {
+                startSemaphore.release();
+            }
         }        
     }
     
-    public void startBundles() {
+    public void startBundles() throws BundleException, IOException {
         BundleContext context = getBundleContext();
         for (String location : bundles) {
-            String mvnLocation = "mvn:" + location;
-            File fileLocation = getBundleLocation(location);
-            try {
-                Bundle b = context.installBundle(mvnLocation, fileLocation.toURL().openStream());
-                if (b != null) {
-                    b.start(Bundle.START_TRANSIENT);
-                }
-            } catch (Exception ex) {
-                System.err.println("Error starting: " + location + " " + fileLocation + " " + ex);
-            }            
+            String[] parts = location.split("/");
+            
+            File fileLocation = getBundleLocation(parts);
+            if (location == null) {
+                System.err.println("Artifact " + location + " not found");
+                continue;
+            }
+            parts[2] = fileLocation.getParentFile().getName();
+            parts[3] = fileLocation.getName().substring(fileLocation.getName().lastIndexOf('.') + 1);
+            
+            String mvnLocation = getMvnLocation(parts);
+            Bundle b = context.installBundle(mvnLocation, fileLocation.toURL().openStream());
+            if (b != null) {
+                b.start(Bundle.START_TRANSIENT);
+            }
         }
     }
     
-    private File getBundleLocation(String name) {
-        String[] parts = name.split("/");
-        String group = parts[0].replace('.', '/');
-        String artifactId = parts[1];
-        String version = parts[2];
-        String type = parts[3];
-        
-        String fileName = group + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "." + type;
-                
+    private String getMvnLocation(String[] parts) {
+        return "mvn:" + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[3]; 
+    }
+    
+    private File getBundleLocation(String[] parts) {
+        String group = parts[0].replace('.', '/').trim();
+        String artifactId = parts[1].trim();
+        String version = parts[2].trim();
+        String type = parts[3].trim();
+                        
         String defaultRepo = System.getProperty(org.apache.felix.karaf.main.Main.DEFAULT_REPO);
         
         File repo = new File(getHome(), defaultRepo);
-        File bundleLocation = new File(repo, fileName);
         
-        return bundleLocation;
+        File base = new File(repo, group + "/" + artifactId);
+        if (base.exists()) {
+            File versionFile = findFile(base, version);
+            if (versionFile != null) {
+                String artifactName = "";
+                if (type.length() != 0) {                        
+                    artifactName = artifactId + "-" + versionFile.getName() + "." + type;
+                }
+                return findFile(versionFile, artifactName);               
+            }
+        }
+        return null;
+    }
+    
+    private File findFile(File base, String name) {
+        File[] files = base.listFiles();
+        if (name.length() == 0) {
+            return (files.length > 0) ? files[0] : null;
+        }
+        for (File file : files) {
+            if (name.equals(file.getName())) {
+                return file;
+            }
+        }
+        return null;
     }
     
     private String getStorageDirectory() throws IOException {

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java Tue Nov 24 20:28:41 2009
@@ -22,8 +22,12 @@
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.osgi.framework.BundleContext;
 
 /**
  * Creates a real mbean server of finds an existing one with the specified mbeanServerId
@@ -31,13 +35,16 @@
  * @version $Rev$ $Date$
  */
 @GBean
-public class RealMBeanServerReference implements MBeanServerReference {
+public class RealMBeanServerReference implements MBeanServerReference, GBeanLifecycle {
     private static final String GERONIMO_DEFAULT_DOMAIN = "geronimo";
 
+    private BundleContext bundleContext;
     private MBeanServer mbeanServer;
 
-    public RealMBeanServerReference(@ParamAttribute(name="usePlatformMBeanServer") boolean usePlatformMBeanServer,
+    public RealMBeanServerReference(@ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
+                                    @ParamAttribute(name="usePlatformMBeanServer") boolean usePlatformMBeanServer,
                                     @ParamAttribute(name="mbeanServerId")String mbeanServerId) throws MBeanServerNotFound {
+        this.bundleContext = bundleContext;
         if (usePlatformMBeanServer) {
             mbeanServer = ManagementFactory.getPlatformMBeanServer();
         } else {
@@ -76,4 +83,17 @@
         return mbeanServer;
     }
 
+    public void doFail() {
+    }
+
+    public void doStart() throws Exception {
+        if (mbeanServer != null) {
+            bundleContext.registerService(MBeanServer.class.getName(), mbeanServer, null);
+        }       
+    }
+
+    public void doStop() throws Exception {
+        // TODO: unregister MBeanServer service?
+    }
+
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java Tue Nov 24 20:28:41 2009
@@ -72,17 +72,15 @@
         return GBEAN_INFO;
     }
 
-    @Override
     public void doFail() {
     }
 
-    @Override
     public void doStart() throws Exception {
         bundle.getBundleContext().registerService(Main.class.getName(), this, new Hashtable());
     }
 
-    @Override
     public void doStop() throws Exception {
+        // TODO: unregister Main service?
     }
     
 }

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=883857&r1=883856&r2=883857&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 Tue Nov 24 20:28:41 2009
@@ -231,18 +231,15 @@
         return GBEAN_INFO;
     }
 
-    @Override
     public void doFail() {
     }
 
-    @Override
     public void doStart() throws Exception {
         bundle.getBundleContext().registerService(Main.class.getName(), this, new Hashtable());
     }
-
-    @Override
+    
     public void doStop() throws Exception {
-
+        // TODO: unregister Main service?
     }
 
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/MainBridge.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/MainBridge.java?rev=883857&r1=883856&r2=883857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/MainBridge.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/MainBridge.java Tue Nov 24 20:28:41 2009
@@ -114,18 +114,15 @@
         return GBEAN_INFO;
     }
 
-    @Override
     public void doFail() {
     }
 
-    @Override
     public void doStart() throws Exception {
         bundle.getBundleContext().registerService(Main.class.getName(), this, new Hashtable());
     }
 
-    @Override
     public void doStop() throws Exception {
-
+        // TODO: unregister Main service?
     }
 
 }



Mime
View raw message