Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2017-05-02 17:24:04 +0000
committerRoland Grunberg2017-06-08 18:57:08 +0000
commit919c0fc9b26aac49ffe0b1a1327733b7177baa1f (patch)
tree1bc989ba354422171c8c66bc97378524731e7e83
parentffbfd06e929fb8290ff38be44337a20de6823760 (diff)
downloadorg.eclipse.linuxtools-919c0fc9b26aac49ffe0b1a1327733b7177baa1f.tar.gz
org.eclipse.linuxtools-919c0fc9b26aac49ffe0b1a1327733b7177baa1f.tar.xz
org.eclipse.linuxtools-919c0fc9b26aac49ffe0b1a1327733b7177baa1f.zip
Create the entrypoint where we'll send the java launch to the container.
In JavaAppInContainerLaunchDelegate#launch(..) we replace the StandardVMRunner with our own (ContainerVMRunner) which will take the given java launch command and evaluate it in a container. Change-Id: I315354679241ea252b06b376abad300414ca575c Reviewed-on: https://git.eclipse.org/r/98932 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java35
-rw-r--r--containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaAppInContainerLaunchDelegate.java6
2 files changed, 40 insertions, 1 deletions
diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java
new file mode 100644
index 0000000000..f830c565ea
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/ContainerVMRunner.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.jdt.docker.launcher;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.internal.launching.StandardVMRunner;
+import org.eclipse.jdt.launching.IVMInstall;
+
+public class ContainerVMRunner extends StandardVMRunner {
+
+ public ContainerVMRunner(IVMInstall vmInstance) {
+ super(vmInstance);
+ }
+
+ protected Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
+ System.out.println("Ran : " + String.join(" ", cmdLine) + " in " + workingDirectory.getAbsolutePath());
+ return null;
+ }
+
+ protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
+ System.out.println("Ran : " + String.join(" ", cmdLine) + " in " + workingDirectory.getAbsolutePath() + " with env.");
+ return null;
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaAppInContainerLaunchDelegate.java b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaAppInContainerLaunchDelegate.java
index 77c95db5be..6f9e98701b 100644
--- a/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaAppInContainerLaunchDelegate.java
+++ b/containers/org.eclipse.linuxtools.jdt.docker.launcher/src/org/eclipse/linuxtools/jdt/docker/launcher/JavaAppInContainerLaunchDelegate.java
@@ -20,6 +20,7 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.osgi.util.NLS;
@@ -45,7 +46,10 @@ public class JavaAppInContainerLaunchDelegate extends AbstractJavaLaunchConfigur
monitor.subTask("Verifying launch attributes...");
String mainTypeName = verifyMainTypeName(configuration);
- IVMRunner runner = getVMRunner(configuration, mode);
+ //TODO: Do this properly by registering our own VM Runner
+ // IVMRunner runner = getVMRunner(configuration, mode);
+ IVMInstall vm = verifyVMInstall(configuration);
+ ContainerVMRunner runner = new ContainerVMRunner(vm);
File workingDir = verifyWorkingDirectory(configuration);
String workingDirName = null;

Back to the top