[Esbox-commits] r943 - in branches/work_Ed: . org.maemo.esbox.vm.vmware org.maemo.esbox.vm.vmware/.settings org.maemo.esbox.vm.vmware/META-INF org.maemo.esbox.vm.vmware/conf org.maemo.esbox.vm.vmware/src org.maemo.esbox.vm.vmware/src/org org.maemo.esbox.vm.vmware/src/org/maemo org.maemo.esbox.vm.vmware/src/org/maemo/esbox org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Mon Nov 17 23:02:53 EET 2008
Author: eswartz
Date: 2008-11-17 23:02:53 +0200 (Mon, 17 Nov 2008)
New Revision: 943
Added:
branches/work_Ed/org.maemo.esbox.vm.vmware/
branches/work_Ed/org.maemo.esbox.vm.vmware/.classpath
branches/work_Ed/org.maemo.esbox.vm.vmware/.project
branches/work_Ed/org.maemo.esbox.vm.vmware/.settings/
branches/work_Ed/org.maemo.esbox.vm.vmware/.settings/org.eclipse.jdt.core.prefs
branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/
branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF
branches/work_Ed/org.maemo.esbox.vm.vmware/build.properties
branches/work_Ed/org.maemo.esbox.vm.vmware/conf/
branches/work_Ed/org.maemo.esbox.vm.vmware/conf/vmware_prefs.xml
branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml
branches/work_Ed/org.maemo.esbox.vm.vmware/src/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/PreferenceVMwareConfiguration.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/Activator.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java
Log:
Add VMware support
Property changes on: branches/work_Ed/org.maemo.esbox.vm.vmware
___________________________________________________________________
Name: svn:ignore
+ bin
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/.classpath
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/.classpath (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/.classpath 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/.project
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/.project (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/.project 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.vm.vmware</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/.settings/org.eclipse.jdt.core.prefs 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,7 @@
+#Mon Nov 17 08:43:00 CST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox VMware Support Plug-in
+Bundle-SymbolicName: org.maemo.esbox.vm.vmware;singleton:=true
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.maemo.esbox.vm.vmware.Activator
+Bundle-Vendor: NOKIA
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.mica.common.core;bundle-version="2.0.0",
+ org.maemo.mica.common.ui;bundle-version="2.0.0",
+ org.maemo.mica.protocol.ssh;bundle-version="2.0.0",
+ org.maemo.esbox.vm;bundle-version="2.0.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="2.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/build.properties
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/build.properties (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/build.properties 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ conf/
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/conf/vmware_prefs.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/conf/vmware_prefs.xml (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/conf/vmware_prefs.xml 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>This file contains the default settings for VMware preferences;
+ see the org.maemo.mica.common.core.preference_set_provider extension</comment>
+
+ <entry key="VMWARE_LAUNCH_PATTERN">"${VMWARE}" -x "${VMX_PATH}"</entry>
+
+ <entry key="VMWARE_EXE_NAME_WIN32">c:/Program Files/VMware/VMware Player/vmware.exe</entry>
+ <entry key="VMWARE_VMX_PATH_WIN32">c:/MaemoVMWare/MaemoSDK-0.8/maemo-sdk-0.8.vmx</entry>
+
+ <entry key="VMWARE_EXE_NAME_UNIX">/usr/bin/vmware</entry>
+ <entry key="VMWARE_VMX_PATH_UNIX">/home/${USER}/MaemoVMWare/MaemoSDK-0.8/maemo-sdk-0.8.vmx</entry>
+
+</properties>
\ No newline at end of file
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.mica.common.core.build_machine_factory">
+ <build_machine_factory
+ class="org.maemo.esbox.internal.vm.vmware.VMwareBuildMachineFactory">
+ </build_machine_factory>
+ </extension>
+
+ <extension
+ point="org.maemo.mica.common.core.preference_set_provider">
+ <preferenceSetProvider
+ defaultsXMLFile="conf/vmware_prefs.xml"
+ preferenceConstantsClass="org.maemo.esbox.internal.vm.vmware.VMwarePreferenceConstants"
+ preferenceMigratorClass="org.maemo.esbox.internal.vm.vmware.VMwarePreferenceMigrator"
+ preferenceStoreBundle="org.maemo.esbox.vm.vmware"
+ version="1">
+ </preferenceSetProvider>
+ </extension>
+ <extension
+ point="org.maemo.mica.common.core.machine_factory">
+ <machineFactory scheme="vmware+ssh"
+ class="org.maemo.esbox.internal.vm.vmware.VMwareMachineFactory">
+ </machineFactory>
+ </extension>
+
+</plugin>
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
+
+import java.net.URI;
+
+/**
+ * This configuration uses settings specified at construction time through the
+ * URI syntax (IMachineFactory)
+ * @author eswartz
+ *
+ */
+public class CustomVMwareConfiguration extends BaseCustomVirtualMachineConfiguration implements IVMwareConfiguration {
+
+ private static final String VMX_PATH = "vmxPath";
+
+ private String vmxPath;
+
+ public CustomVMwareConfiguration(URI uri, ISharedFilesystemProvider sharedFilesystemProvider) throws MicaException {
+ super(uri, sharedFilesystemProvider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#setupDefaults()
+ */
+ @Override
+ protected void setupDefaults() {
+ super.setupDefaults();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#decodeQueryPart(java.lang.String, java.lang.String)
+ */
+ @Override
+ protected boolean decodeQueryPart(String key, String value) {
+ if (super.decodeQueryPart(key, value))
+ return true;
+
+ if (key.equals(VMX_PATH)) {
+ vmxPath = value;
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.vm.vmware.IVMwareConfiguration#getVmxPath()
+ */
+ public String getVmxPath() {
+ return vmxPath;
+ }
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/PreferenceVMwareConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/PreferenceVMwareConfiguration.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/PreferenceVMwareConfiguration.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.esbox.internal.api.vm.core.BasePreferenceVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+
+/**
+ * This configuration reads settings from the preference store (VirtualMachinePreferenceConstants,
+ * VMwarePreferenceConstants). The settings will change as the preferences change.
+ * @author eswartz
+ *
+ */
+public class PreferenceVMwareConfiguration extends BasePreferenceVirtualMachineConfiguration implements IVMwareConfiguration {
+
+ public String getVmxPath() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_VMX_PATH);
+ }
+
+ public String getExecutable() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_EXE_NAME);
+ }
+
+ public String getCommandLaunchPattern() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN);
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.mica.common.core.machine.IBuildMachineFactory;
+import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
+
+/**
+ * This factory creates virtual build machines hosted on VMware.
+ * We support only one such machine at a time, using preferences to store its settings.
+ * @author eswartz
+ *
+ */
+public class VMwareBuildMachineFactory implements IBuildMachineFactory {
+
+ public final static String NAME = "VMware Linux Build Machine";
+ public VMwareBuildMachineFactory() {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.lang.String)
+ */
+ public synchronized IBuildMachineImpl[] getMachines() {
+ IBuildMachineImpl qemuMachine = new VMwareMachine(NAME, new PreferenceVMwareConfiguration());
+ return new IBuildMachineImpl[] { qemuMachine };
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.Activator;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.machine.IComposablePreferencePage;
+import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
+import org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend;
+
+import java.net.URI;
+
+
+/**
+ * This is a build machine running under QEMU.
+ * @author eswartz
+ *
+ */
+public class VMwareMachine extends SSHMachineBackend implements IVirtualMachine, IBuildMachineImpl {
+
+ public final static String ID = Activator.PLUGIN_ID + ".vmware_machine";
+ //
+ private IVMwareConfiguration configuration;
+
+ public VMwareMachine(String name, IVMwareConfiguration configuration) {
+ super(ID, name, Platform.OS_LINUX, Platform.ARCH_X86,
+ new VMwareMachineController(configuration),
+ configuration.getSSHConfiguration(), configuration.getSharedFilesystemProvider());
+ this.configuration = configuration;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
+ */
+ public IComposablePreferencePage createPreferencePage() {
+ return new VMwarePreferencePage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.vm.core.IVirtualMachine#getConfiguration()
+ */
+ public IVirtualMachineConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend#getURI()
+ */
+ @Override
+ public URI getURI() {
+ return URI.create("vmware+ssh://"
+ + getSshConfiguration().getTargetIPAddress()
+ + ":"
+ + getSshConfiguration().getTargetPort());
+ }
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.process.*;
+
+import java.util.List;
+
+/**
+ * This is the basic implementation of a QEMU machine
+ * @author eswartz
+ *
+ */
+public class VMwareMachineController extends BaseVirtualMachineController {
+
+ /**
+ * @param name
+ * @param configuration
+ */
+ public VMwareMachineController(IVirtualMachineConfiguration configuration) {
+ super("VMware", configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#constructLaunchParameters()
+ */
+ @Override
+ protected ProcessLauncherParameters constructLaunchParameters() {
+ IVMwareConfiguration vmwareConfiguration = (IVMwareConfiguration) machineConfiguration;
+
+ String launchPattern = vmwareConfiguration.getCommandLaunchPattern();
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ IPath launchPath = new Path(vmwareConfiguration.getExecutable());
+ substitutor.define("VMWARE", launchPath.toOSString());
+ substitutor.define("VMX_PATH", new Path(vmwareConfiguration.getVmxPath()).toOSString());
+
+ launchPattern = substitutor.substitute(launchPattern);
+ List<String> cmdLine = CommandLineArguments.createFromHostCommandLine(launchPattern);
+
+ return new ProcessLauncherParameters(null, cmdLine, null);
+ }
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.*;
+
+import java.net.URI;
+
+/**
+ * This factory creates QEMU virtual machines.
+ * @author eswartz
+ *
+ */
+public class VMwareMachineFactory implements IMachineFactory {
+
+ /**
+ * Scheme for QEMU
+ */
+ private static final String QEMU_SCHEME = "qemu+ssh";
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.net.URI)
+ */
+ public IMachine createMachine(String name, URI uri, ISharedFilesystemProvider sharedFilesystemProvider) throws MicaException {
+ if (!uri.getScheme().equals(QEMU_SCHEME))
+ return null;
+
+ IVMwareConfiguration qemuConfig = new CustomVMwareConfiguration(uri, sharedFilesystemProvider);
+ return new VMwareMachine(name, qemuConfig);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#getScheme()
+ */
+ public String getScheme() {
+ return QEMU_SCHEME;
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.vmware.Activator;
+
+/**
+ * This class encapsulates the keys for preference constants for QEMU configuration.
+ * NOTE: use {@link IVirtualMachine#getConfiguration()} to access these, not
+ * CorePreferenceManager.
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceConstants {
+ public static final int VERSION_MAJOR = 1;
+ public static final int VERSION_MINOR = 0;
+
+ /** Get the preference store that contains these preferences */
+ public static IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+ public static final String VMWARE_EXE_NAME = "VMWARE_EXE_NAME";
+ public static final String VMWARE_LAUNCH_PATTERN = "VMWARE_LAUNCH_PATTERN";
+ public static final String VMWARE_VMX_PATH = "VMWARE_VMX_PATH";
+
+ static final Class privateKeysClass = VMwarePreferenceConstantsPrivate.class;
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+/**
+ * Private keys for VMware prefs initialization
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceConstantsPrivate {
+ static final String VMWARE_EXE_NAME_WIN32 = "VMWARE_EXE_NAME_WIN32";
+ static final String VMWARE_VMX_PATH_WIN32 = "VMWARE_VMX_PATH_WIN32";
+
+ static final String VMWARE_EXE_NAME_UNIX = "VMWARE_EXE_NAME_UNIX";
+ static final String VMWARE_VMX_PATH_UNIX = "VMWARE_VMX_PATH_UNIX";
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.core.IPreferenceMigrator;
+
+import java.util.Properties;
+
+/**
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceMigrator implements IPreferenceMigrator {
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.IPreferenceMigrator#adjustDefaultSettings(java.util.Properties)
+ */
+ public void adjustDefaultSettings(Properties newPropertyDefaults) {
+ // adjust any environment-dependent defaults
+ String hostEnvKey;
+ if (HostUtils.isWindows())
+ hostEnvKey = VMwarePreferenceConstantsPrivate.VMWARE_EXE_NAME_WIN32;
+ else
+ hostEnvKey = VMwarePreferenceConstantsPrivate.VMWARE_EXE_NAME_UNIX;
+ newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_EXE_NAME,
+ expandVariables(newPropertyDefaults.getProperty(hostEnvKey)));
+
+ if (HostUtils.isWindows())
+ hostEnvKey = VMwarePreferenceConstantsPrivate.VMWARE_VMX_PATH_WIN32;
+ else
+ hostEnvKey = VMwarePreferenceConstantsPrivate.VMWARE_VMX_PATH_UNIX;
+ newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_VMX_PATH,
+ expandVariables(newPropertyDefaults.getProperty(hostEnvKey)));
+ }
+
+ /** Expand variables in defaults.
+ *
+ * TODO: reconcile this with UserAwarePreferenceProvider
+ */
+ private String expandVariables(String property) {
+ String expanded = property.replaceAll("\\$\\{USER\\}", System.getProperty("user.name"));
+ return expanded;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.IPreferenceMigrator#convertExistingPreferences(org.eclipse.jface.preference.IPreferenceStore, int, java.util.Properties, java.util.Properties)
+ */
+ public void convertExistingPreferences(IPreferenceStore preferences,
+ int oldMajor, Properties existingSettings,
+ Properties newPropertyDefaults) {
+
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
+import org.maemo.mica.common.core.machine.IComposablePreferencePage;
+
+/**
+ * Configure VMware preferences. This page is NOT registered at the top level
+ * of preference page UI but is nested inside the ESbox Build Machine preference UI.
+ * @author eswartz
+ *
+ */
+public class VMwarePreferencePage extends BaseVirtualMachinePreferencePage {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createVirtualMachinePreferencePage()
+ */
+ @Override
+ protected IComposablePreferencePage createVirtualMachinePreferencePage() {
+ return new VMwareSettingsPreferencePage();
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.mica.common.ui.preferences.*;
+
+/**
+ * Configure VMware preferences. This page is NOT registered at the top level
+ * of preference page UI but is nested inside the ESbox Build Machine preference UI.
+ * @author eswartz
+ *
+ */
+public class VMwareSettingsPreferencePage extends BaseComposableFieldEditorPreferencePage {
+
+ private FileFieldEditor feVmxPath;
+ private StringFieldEditor feVMWAREExeName;
+ private StringFieldEditor feVMWARELaunchPattern;
+
+ /**
+ *
+ */
+ public VMwareSettingsPreferencePage() {
+ setTitle("VMware Options");
+ setPreferenceStore(VMwarePreferenceConstants.getPreferenceStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ Text text;
+
+ /*
+ feVMWAREPath = new NonValidatingDirectoryFieldEditor(
+ VMwarePreferenceConstants.VMWARE_INSTALL_PATH,
+ "Installation directory:", getFieldEditorParent());
+ addField(feVMWAREPath);
+ text = feVMWAREPath.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the full path to a VMware installation.");
+ */
+
+ feVMWAREExeName = new FileFieldEditor(
+ VMwarePreferenceConstants.VMWARE_EXE_NAME,
+ "Executable:", getFieldEditorParent());
+ addField(feVMWAREExeName);
+ text = feVMWAREExeName.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the VMware executable to launch (Player, Server, or Workstation). If the program lives in the installation directory or on the PATH, provide a bare filename. Otherwise, provide a full path to vmware.exe.");
+
+ feVMWARELaunchPattern = new StringFieldEditor(
+ VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN,
+ "Command pattern:",
+ getFieldEditorParent());
+ addField(feVMWARELaunchPattern);
+ text = feVMWARELaunchPattern.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the specific command pattern to use to launch the virtual machine.");
+
+ // make this string manageable -- we want it to be long but not to force other
+ // fields off the edge
+ int width;
+ GC gc = new GC(getFieldEditorParent().getShell());
+ width = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = width;
+ text.setLayoutData(
+ gridData);
+
+ feVmxPath = new NonValidatingFileFieldEditor(
+ VMwarePreferenceConstants.VMWARE_VMX_PATH,
+ "VMX path:", getFieldEditorParent());
+ addField(feVmxPath);
+ text = feVmxPath.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the full path to the VMX file for the machine.");
+
+ }
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/Activator.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/Activator.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/Activator.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.vm.vmware;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.mica.common.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.vm.vmware";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java 2008-11-17 21:02:53 UTC (rev 943)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * 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:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.vm.vmware;
+
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+
+/**
+ * This interface, implemented by clients, provides settings needed
+ * to launch and communicate with a virtual machine using VMware.
+ * <p>
+ * The stock implementation for VMware machines created by IBuildMachineProvider
+ * reads the corresponding settings dynamically from VMwarePreferenceConstants.
+ * @author eswartz
+ *
+ */
+public interface IVMwareConfiguration extends IVirtualMachineConfiguration {
+
+ /** Get the installation path. */
+ //String getInstallPath();
+
+ /** Get the VMX path */
+ String getVmxPath();
+
+
+
+}
More information about the Esbox-commits
mailing list