You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/09/05 22:03:58 UTC
svn commit: r692524 -
/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
Author: gnodet
Date: Fri Sep 5 13:03:57 2008
New Revision: 692524
URL: http://svn.apache.org/viewvc?rev=692524&view=rev
Log:
SMX4KNL-75: Modify GShell argument processing to execute multiple commands
Modified:
servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java?rev=692524&r1=692523&r2=692524&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java Fri Sep 5 13:03:57 2008
@@ -114,7 +114,11 @@
if (args != null && args.length > 0) {
waitForFrameworkToStart();
log.info("Executing Shell with arguments: " + Arguments.asString(args));
- Object value = shell.execute((Object[]) args);
+ StringBuilder sb = new StringBuilder();
+ for (String arg : args) {
+ sb.append(arg).append(" ");
+ }
+ Object value = shell.execute(sb.toString());
if (mainService != null) {
if (value instanceof Number) {
mainService.setExitCode(((Number) value).intValue());
@@ -122,15 +126,12 @@
mainService.setExitCode(value != null ? 1 : 0);
}
log.info("Exiting shell due to terminated command");
- try {
- getBundleContext().getBundle(0).stop();
- } catch (BundleException e2) {
- log.info("Caught exception while shutting down framework: " + e2, e2);
- }
+ asyncShutdown();
}
} else {
// Otherwise go into a command shell.
shell.run();
+ asyncShutdown();
}
} catch (Throwable e) {
@@ -149,18 +150,22 @@
}
log.info("Exiting shell due to caught exception " + e, e);
}
- new Thread() {
- public void run() {
- try {
- getBundleContext().getBundle(0).stop();
- } catch (BundleException e2) {
- log.info("Caught exception while shutting down framework: " + e2, e2);
- }
- }
- }.start();
+ asyncShutdown();
}
}
+ private void asyncShutdown() {
+ new Thread() {
+ public void run() {
+ try {
+ getBundleContext().getBundle(0).stop();
+ } catch (BundleException e2) {
+ log.info("Caught exception while shutting down framework: " + e2, e2);
+ }
+ }
+ }.start();
+ }
+
/**
* Blocks until the framework has finished starting. We do this so that any installed
* bundles for commands get fully registered.