geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r567857 - /geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy
Date Mon, 20 Aug 2007 22:25:01 GMT
Author: jdillon
Date: Mon Aug 20 15:25:00 2007
New Revision: 567857

URL: http://svn.apache.org/viewvc?rev=567857&view=rev
Log:
Finally hook up rc.d script invocation

Modified:
    geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy

Modified: geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy?rev=567857&r1=567856&r2=567857&view=diff
==============================================================================
--- geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy
(original)
+++ geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy
Mon Aug 20 15:25:00 2007
@@ -40,6 +40,8 @@
 class StartServerCommand
     extends CommandSupport
 {
+    private AntBuilder ant
+    
     File geronimoHome
 
     File javaVirtualMachine
@@ -263,8 +265,7 @@
         assert args != null
         
         def io = getIO()
-        
-        def ant = new AntBuilder(log, io)
+        ant = new AntBuilder(log, io)
         
         if (!geronimoHome) {
             geronimoHome = new File(System.properties['gshell.home'])
@@ -282,9 +283,7 @@
         properties['java.endorsed.dirs'] = prefixSystemPath('java.endorsed.dirs', new File(geronimoHome,
'lib/endorsed'))
         properties['java.ext.dirs'] = prefixSystemPath('java.ext.dirs', new File(geronimoHome,
'lib/ext'))
         
-        //
-        // TODO: Add rc script muck here...
-        //
+        processScripts()
         
         // If we are not backgrounding, then add a nice message for the user when ctrl-c
gets hit
         if (!background) {
@@ -362,6 +361,8 @@
                 }
                 
                 tmp("Process exited with status: $e.status")
+                
+                throw e
             }
         }
         
@@ -374,6 +375,28 @@
         launcher.launch()
         
         return Command.SUCCESS
+    }
+    
+    private void processScripts() {
+        def scanner = ant.fileScanner {
+            fileset(dir: "$geronimoHome/etc/rc.d") {
+                include(name: '*.groovy')
+            }
+        }
+        
+        def vars = [
+            command: this,
+            log: log,
+            io: getIO(),
+        ]
+        
+        def binding = new Binding(vars)
+        def shell = new GroovyShell(binding)
+        
+        for (file in scanner) {
+            log.debug("Loading script: $file")
+            shell.evaluate(file)
+        }
     }
     
     private String prefixSystemPath(final String name, final File file) {



Mime
View raw message