geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r430192 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core: ./ internal/
Date Thu, 10 Aug 2006 00:03:03 GMT
Author: sppatel
Date: Wed Aug  9 17:03:02 2006
New Revision: 430192

URL: http://svn.apache.org/viewvc?rev=430192&view=rev
Log:
GERONIMODEVTOOLS-52 provide own launchconfigdelegate

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.properties

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java?rev=430192&r1=430191&r2=430192&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoLaunchConfigurationDelegate.java
Wed Aug  9 17:03:02 2006
@@ -15,11 +15,25 @@
  */
 package org.apache.geronimo.st.core;
 
+import java.io.File;
+import java.util.Map;
+
+import org.apache.geronimo.st.core.internal.Messages;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
 
 public class GeronimoLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate
{
 
@@ -32,6 +46,56 @@
 	 */
 	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor
monitor) throws CoreException {
 
+		IServer server = ServerUtil.getServer(configuration);
+		if (server == null) {
+			throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR,
Messages.missingServer, null));
+		}
+		GeronimoServerBehaviourDelegate geronimoServer = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class,
null);
+		geronimoServer.setupLaunch(launch, mode, monitor);
+
+		if (geronimoServer.isRemote()) {
+			// no support for launching remote servers
+			return;
+		}
+
+		String mainTypeName = geronimoServer.getRuntimeClass();
+		IVMInstall vm = verifyVMInstall(configuration);
+		IVMRunner runner = vm.getVMRunner(mode);
+
+		if (runner == null)
+			runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
+
+		File workingDir = verifyWorkingDirectory(configuration);
+		String workingDirName = null;
+		if (workingDir != null)
+			workingDirName = workingDir.getAbsolutePath();
+
+		String pgmArgs = getProgramArguments(configuration);
+		String vmArgs = getVMArguments(configuration);
+		String[] envp = getEnvironment(configuration);
+
+		ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
+		Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+		String[] classpath = getClasspath(configuration);
+
+		// Create VM config
+		VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+		runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+		runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+		runConfig.setWorkingDirectory(workingDirName);
+		runConfig.setEnvironment(envp);
+		runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+
+		// Bootpath
+		String[] bootpath = getBootpath(configuration);
+		if (bootpath != null && bootpath.length > 0)
+			runConfig.setBootClassPath(bootpath);
+
+		setDefaultSourceLocator(launch, configuration);
+
+		geronimoServer.startPingThread();
+		runner.run(runConfig, launch, monitor);
+		geronimoServer.setProcess(launch.getProcesses()[0]);
 	}
 
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?rev=430192&r1=430191&r2=430192&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Wed Aug  9 17:03:02 2006
@@ -84,7 +84,7 @@
 		if (isRemote())// No launch for remote servers.
 			return;
 
-		wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.geronimo.system.main.Daemon");
+		wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, getRuntimeClass());
 
 		GeronimoRuntimeDelegate runtime = getRuntimeDelegate();
 
@@ -220,6 +220,10 @@
 	 */
 	public void dispose() {
 		stopUpdateServerStateTask();
+	}
+	
+	public String getRuntimeClass() {
+		return "org.apache.geronimo.system.main.Daemon";
 	}
 
 	public void setServerStarted() {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.java?rev=430192&r1=430191&r2=430192&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.java
Wed Aug  9 17:03:02 2006
@@ -42,5 +42,6 @@
 	public static String noVersion;
 	public static String missingContent;
 	public static String errorPortInUse;
+	public static String missingServer;
 
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.properties?rev=430192&r1=430191&r2=430192&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Messages.properties
Wed Aug  9 17:03:02 2006
@@ -13,4 +13,5 @@
 missingContent=A geronimo installation was detected, however parts of the server seem to
be missing.
 errorJRE=The JRE could not be found. Edit the server and change the JRE location.
 errorPortInUse=Port {0} required by {1} is already in use. The server may already be running
in another process, or a system process may be using the port. \
-To start this server you will need to stop the other process or change the port number(s).
\ No newline at end of file
+To start this server you will need to stop the other process or change the port number(s).
+missingServer=Server does not exist
\ No newline at end of file



Mime
View raw message