geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r567798 - /geronimo/sandbox/server-gshell-launcher/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/StartServerCommand.groovy
Date Mon, 20 Aug 2007 19:32:29 GMT
Author: jdillon
Date: Mon Aug 20 12:32:28 2007
New Revision: 567798

URL: http://svn.apache.org/viewvc?rev=567798&view=rev
Log:
Put default flags and properties into our collections to allow scripts to change them

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=567798&r1=567797&r2=567798&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 12:32:28 2007
@@ -202,7 +202,26 @@
         
         return false
     }
-
+    
+    private File getJavaAgentJar() {
+        def file = new File(geronimoHome, 'bin/jpa.jar')
+        
+        if (javaAgent) {
+            if (javaAgent.toLowerCase() == 'none') {
+                file = null
+            }
+            else {
+                file = new File(javaAgent)
+                
+                if (!file.exists()) {
+                    log.warn("Missing Java Agent jar: $file")
+                }
+            }
+        }
+        
+        return file
+    }
+    
     protected Object doExecute(Object[] args) throws Exception {
         assert args != null
         
@@ -223,6 +242,12 @@
                 node.setAttribute('timeout', "${timeout * 1000}")
             }
             
+            if (logFile) {
+                log.info("Redirecting output to: $logFile")
+                logFile.parentFile.mkdirs()
+                redirector(output: logFile)
+            }
+            
             if (javaVirtualMachine) {
                 if (!javaVirtualMachine.exists()) {
                     fail("Java virtual machine is not valid: $javaVirtualMachine")
@@ -232,52 +257,23 @@
                 node.setAttribute('jvm', javaVirtualMachine)
             }
             
-            if (logFile) {
-                log.info("Redirecting output to: $logFile")
-                logFile.parentFile.mkdirs()
-                redirector(output: logFile)
+            if (javaAgentJar) {
+                javaFlags << "-javaagent:${javaAgentJar.canonicalPath}"
             }
             
-            
-            //
-            // TODO: Methodize this...
-            //
-            
-            // Load the Java programming language agent for JPA if the jar exists
-            def javaAgentJar = new File(geronimoHome, 'bin/jpa.jar')
-            
-            if (javaAgent) {
-                if (javaAgent.toLowerCase() == 'none') {
-                    javaAgentJar = null
-                }
-                else {
-                    javaAgentJar = new File(javaAgent)
-                }
+            javaFlags.each {
+                jvmarg(value: it)
             }
             
-            if (javaAgentJar) {
-                if (javaAgentJar.exists()) {
-                    log.info("Using Java Agent: $javaAgentJar")
-                    jvmarg(value: "-javaagent:${javaAgentJar.canonicalPath}")
-                }
-                else {
-                    log.warn("Missing Java Agent jar: $javaAgentJar")
-                }
-            }
+            // Setup the default properties required to boot the server
+            properties['org.apache.geronimo.base.dir'] = geronimoHome
+            properties['java.io.tmpdir'] = 'var/temp' // Use relative path
+            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'))
             
             properties.each { key, value ->
                 sysproperty(key: key, value: value)
             }
-            
-            javaFlags.each {
-                jvmarg(value: it)
-            }
-            
-            // Set the properties which we pass to the JVM from the startup script
-            sysproperty(key: 'org.apache.geronimo.base.dir', file: geronimoHome)
-            sysproperty(key: 'java.io.tmpdir', value: 'var/temp') // Use relative path
-            sysproperty(key: 'java.endorsed.dirs', value: prefixSystemPath('java.endorsed.dirs',
new File(geronimoHome, 'lib/endorsed')))
-            sysproperty(key: 'java.ext.dirs', value: prefixSystemPath('java.ext.dirs', new
File(geronimoHome, 'lib/ext')))
             
             if (quiet) {
                 arg(value: '--quiet')



Mime
View raw message