servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r732285 - in /servicemix/smx4/kernel/trunk/gshell/gshell-admin/src: main/java/org/apache/servicemix/jpm/impl/ main/java/org/apache/servicemix/kernel/gshell/admin/internal/ test/java/org/apache/servicemix/jpm/
Date Wed, 07 Jan 2009 09:39:00 GMT
Author: gnodet
Date: Wed Jan  7 01:38:58 2009
New Revision: 732285

URL: http://svn.apache.org/viewvc?rev=732285&view=rev
Log:
SMX4KNL-142: Starting a new instance that was created with admin fail on windows

Modified:
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/jpm/impl/ProcessImpl.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/test/java/org/apache/servicemix/jpm/ProcessTest.java

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/jpm/impl/ProcessImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/jpm/impl/ProcessImpl.java?rev=732285&r1=732284&r2=732285&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/jpm/impl/ProcessImpl.java
(original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/jpm/impl/ProcessImpl.java
Wed Jan  7 01:38:58 2009
@@ -118,6 +118,9 @@
             //props.put("${err.file}", error.getCanonicalPath());
             props.put("${pid.file}", pidFile.getCanonicalPath());
             props.put("${dir}", dir != null ? dir.getCanonicalPath() : "");
+            if (ScriptUtils.isWindows()) {
+                command = command.replaceAll("\"", "\"\"");
+            }
             props.put("${command}", command);
             int ret = ScriptUtils.execute("start", props);
             if (ret != 0) {

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java?rev=732285&r1=732284&r2=732285&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
(original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
Wed Jan  7 01:38:58 2009
@@ -24,16 +24,19 @@
 import java.io.OutputStream;
 import java.io.FilenameFilter;
 import java.util.Properties;
-import java.net.URI;
 import java.net.Socket;
 
 import org.apache.servicemix.jpm.Process;
 import org.apache.servicemix.jpm.ProcessBuilderFactory;
 import org.apache.servicemix.jpm.impl.ScriptUtils;
 import org.apache.servicemix.kernel.gshell.admin.Instance;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class InstanceImpl implements Instance {
 
+    private static final Log LOG = LogFactory.getLog(InstanceImpl.class);
+
     private AdminServiceImpl service;
     private String name;
     private String location;
@@ -110,7 +113,7 @@
             throw new IllegalStateException("Instance already started");
         }
         if (javaOpts == null) {
-            javaOpts = "-server -Xms128M -Xmx512M -Dcom.sun.management.jmxremote";
+            javaOpts = "-server -Xmx512M -Dcom.sun.management.jmxremote";
         }
         File libDir = new File(System.getProperty("servicemix.home"), "lib");
         File[] jars = libDir.listFiles(new FilenameFilter() {
@@ -125,7 +128,7 @@
             }
             classpath.append(jar.getCanonicalPath());
         }
-        String command = new File(System.getProperty("java.home"), "bin/java" + (ScriptUtils.isWindows()
? ".exe" : "")).getCanonicalPath()
+        String command = new File(System.getProperty("java.home"), ScriptUtils.isWindows()
? "bin\\java.exe" : "bin/java").getCanonicalPath()
                 + " " + javaOpts
                 + " -Dservicemix.home=\"" + System.getProperty("servicemix.home") + "\""
                 + " -Dservicemix.base=\"" + new File(location).getCanonicalPath() + "\""
@@ -133,6 +136,7 @@
                 + " -Dservicemix.startRemoteShell=true"
                 + " -classpath " + classpath.toString()
                 + " org.apache.servicemix.kernel.main.Main";
+        LOG.debug("Starting instance with command: " + command);
         this.process = ProcessBuilderFactory.newInstance().newBuilder()
                         .directory(new File(location))
                         .command(command)

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/test/java/org/apache/servicemix/jpm/ProcessTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/test/java/org/apache/servicemix/jpm/ProcessTest.java?rev=732285&r1=732284&r2=732285&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/test/java/org/apache/servicemix/jpm/ProcessTest.java
(original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/test/java/org/apache/servicemix/jpm/ProcessTest.java
Wed Jan  7 01:38:58 2009
@@ -24,10 +24,11 @@
 public class ProcessTest extends TestCase {
 
     public void testCreate() throws Exception {
-        String javaPath = new File(System.getProperty("java.home"), "bin/java" + (ScriptUtils.isWindows()
? ".exe" : "")).getCanonicalPath();
+        String javaPath = new File(System.getProperty("java.home"), ScriptUtils.isWindows()
? "bin\\java.exe" : "bin/java").getCanonicalPath();
         System.err.println(javaPath);
         StringBuilder command = new StringBuilder();
         command.append(javaPath);
+        command.append(" -Dprop=\"key\"");
         command.append(" -classpath ");
         String clRes = getClass().getName().replace('.', '/') + ".class";
         String str = getClass().getClassLoader().getResource(clRes).toString();



Mime
View raw message