[Esbox-commits] r1059 - in trunk: org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware

eswartz at garage.maemo.org eswartz at garage.maemo.org
Fri Dec 12 04:39:48 EET 2008


Author: eswartz
Date: 2008-12-12 04:39:48 +0200 (Fri, 12 Dec 2008)
New Revision: 1059

Added:
   trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxAptPackageManagerBridge.java
   trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineURIQueryDecoder.java
Modified:
   trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxPackageManagerProvider.java
   trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java
   trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
   trunk/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/CustomQemuConfiguration.java
   trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java
   trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseCustomVirtualMachineConfiguration.java
   trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java
   trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
Log:
Copy from rev 695 in work_Ed branch.  Implements features to detect platforms and sync packages on devices & scratchbox targets.  Also abstract out the URI query parser for other use.

Copied: trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxAptPackageManagerBridge.java (from rev 1058, branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxAptPackageManagerBridge.java)
===================================================================
--- trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxAptPackageManagerBridge.java	                        (rev 0)
+++ trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxAptPackageManagerBridge.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -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.api.scratchbox.core;
+
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.mica.common.core.machine.IFileSystemAccess;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.linux.packages.core.aptpkgconfig.IAptPackageManagerBridge;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ScratchboxAptPackageManagerBridge implements IAptPackageManagerBridge {
+
+	private final IScratchboxSDKTarget sdkTarget;
+	public ScratchboxAptPackageManagerBridge(IScratchboxSDKTarget sdkTarget) {
+		this.sdkTarget = sdkTarget;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.linux.packages.core.adapters.IAptPackageManagerAdapter#createAptConfigurationFileSystemAccess()
+	 */
+	public IFileSystemAccess createAptConfigurationFileSystemAccess(boolean writeable) {
+		// no special privileges needed since the rootstrap has the user's ownership
+		return sdkTarget.getTargetFileSystemAccess();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.linux.packages.core.aptpkgconfig.IAptPackageManagerBridge#createAptGetProcessLauncherFactory()
+	 */
+	public IProcessLauncherFactory createAptGetOrDpkgProcessLauncherFactory() {
+		// in sb, apt commands must either be run as fakeroot or with different mapping modes
+		IProcessLauncherFactory aptProcessLauncherFactory;
+		aptProcessLauncherFactory = sdkTarget.getProcessLauncherFactoryForInstall();
+		return aptProcessLauncherFactory;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.linux.packages.core.aptpkgconfig.IAptPackageManagerBridge#createAptCacheProcessLauncherFactory()
+	 */
+	public IProcessLauncherFactory createAptCacheOrDpkgProcessLauncherFactory() {
+		// in sb, apt commands must either be run as fakeroot or with different mapping modes
+		IProcessLauncherFactory aptProcessLauncherFactory;
+		// we're not really installing, but sb1 and sb2 don't need special permissions either way
+		aptProcessLauncherFactory = sdkTarget.getProcessLauncherFactoryForInstall();
+		return aptProcessLauncherFactory;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.linux.packages.core.adapters.IAptPackageManagerAdapter#createPkgConfigProcessLauncherFactory()
+	 */
+	public IProcessLauncherFactory createPkgConfigProcessLauncherFactory() {
+		// in sb, apt commands must either be run as fakeroot or with different mapping modes
+		IProcessLauncherFactory pkgconfigProcessLauncherFactory = sdkTarget.getProcessLauncherFactory();
+		return pkgconfigProcessLauncherFactory;
+	}
+
+}

Modified: trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxPackageManagerProvider.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxPackageManagerProvider.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/ScratchboxPackageManagerProvider.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -12,7 +12,6 @@
 package org.maemo.esbox.internal.api.scratchbox.core;
 
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
-import org.maemo.mica.common.core.process.IProcessLauncherFactory;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 import org.maemo.mica.linux.packages.core.IPackageManager;
 import org.maemo.mica.linux.packages.core.IPackageManagerProvider;
@@ -24,8 +23,7 @@
  * @author eswartz
  * 
  */
-public class ScratchboxPackageManagerProvider implements
-		IPackageManagerProvider {
+public class ScratchboxPackageManagerProvider implements IPackageManagerProvider {
 
 	/**
 	 * 
@@ -36,26 +34,15 @@
 	/*
 	 * (non-Javadoc)
 	 * 
-	 * @seeorg.maemo.esbox.linux.packages.core.IPackageManagerProvider#
+	 * @see org.maemo.esbox.linux.packages.core.IPackageManagerProvider#
 	 * createPackageManager(org.maemo.esbox.common.core.sdk.ISDKTarget)
 	 */
 	public IPackageManager createPackageManager(ISDKTarget sdkTarget) {
 		if (!(sdkTarget instanceof IScratchboxSDKTarget))
 			return null;
 
-		// in sb2, apt commands must be run as root
-		IProcessLauncherFactory aptProcessLauncherFactory;
-		if (sdkTarget instanceof IScratchboxSDKTarget)
-			aptProcessLauncherFactory = ((IScratchboxSDKTarget) sdkTarget)
-					.getProcessLauncherFactoryForInstall();
-		else
-			aptProcessLauncherFactory = sdkTarget.getProcessLauncherFactory();
-
-		IProcessLauncherFactory pkgconfigProcessLauncherFactory = sdkTarget
-				.getProcessLauncherFactory();
-
-		IPackageManager manager = new AptPackageManager(sdkTarget,
-				aptProcessLauncherFactory, pkgconfigProcessLauncherFactory);
+		IPackageManager manager = new AptPackageManager(sdkTarget, 
+				new ScratchboxAptPackageManagerBridge((IScratchboxSDKTarget) sdkTarget));
 		return manager;
 	}
 

Modified: trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -16,6 +16,7 @@
  * Helper interface to identify the platform and architecture
  * 
  * @author eswartz
+ * @deprecated see IPlatformDetectorAdapter and SDKFactory#establishPlatform()
  * 
  */
 public interface IScratchboxSDKPlatformArchitectureProvider {

Modified: trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -23,8 +23,8 @@
 import org.maemo.mica.common.core.sdk.*;
 import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
 import org.maemo.mica.internal.api.common.core.sdk.BaseSDKPlatform;
-import org.maemo.mica.maemosdk.core.MaemoSDKEngine;
-import org.maemo.mica.maemosdk.core.MaemoSDKInfo;
+import org.maemo.mica.maemosdk.core.MaemoSDKPlatformEngine;
+import org.maemo.mica.maemosdk.core.MaemoSDKPlatform;
 
 import java.util.*;
 
@@ -332,13 +332,9 @@
 				platformName = platform.substring(0, 1).toUpperCase()
 						+ platform.substring(1).toLowerCase();
 
-				List<MaemoSDKInfo> maemoSDKS = MaemoSDKEngine.getInstance()
-						.getMaemoSDKS();
-				for (MaemoSDKInfo info : maemoSDKS) {
-					if (info.getName().equalsIgnoreCase(platformName)) {
-						version = info.getVersion();
-						break;
-					}
+				MaemoSDKPlatform info = MaemoSDKPlatformEngine.getInstance().getPlatformForName(platformName);
+				if (info != null) { 
+					return info;
 				}
 			} else {
 				// TODO: look at key files or versions to determine the

Modified: trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseCustomVirtualMachineConfiguration.java
===================================================================
--- trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseCustomVirtualMachineConfiguration.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseCustomVirtualMachineConfiguration.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -10,9 +10,11 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.api.vm.core;
 
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
 import org.maemo.esbox.internal.vm.Activator;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.*;
 import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
 import org.maemo.mica.protocol.ssh.SSHConfiguration;
 
@@ -26,13 +28,6 @@
  */
 public abstract class BaseCustomVirtualMachineConfiguration implements IVirtualMachineConfiguration {
 	
-	private static final String SSH_HOST_ADDRESS = "sshHostAddress";
-	private static final String SSH_HOST_PORT = "sshHostPort";
-	private static final String TIMEOUT = "timeout";
-	private static final String CIFS_PORT = "cifsPort";
-	private static final String COMMAND_LAUNCH_PATTERN = "commandLaunchPattern";
-	private static final String EXECUTABLE = "executable";
-	
 	protected SSHConfiguration sshConfiguration;
 	protected String executable;
 	protected String commandLaunchPattern;
@@ -45,58 +40,27 @@
 
 		setupDefaults();
 		
-		String query = uri.getQuery();
-		String[] queryParts = query.split("&");
-		for (String queryPart : queryParts) {
-			int equIdx = queryPart.indexOf("=");
-			if (equIdx < 0)
-				throw new MicaException("Invalid query component: " + queryPart);
-			
-			String key = queryPart.substring(0, equIdx);
-			String value = queryPart.substring(equIdx + 1);
-
-			try {
-				if (decodeQueryPart(key, value)) {
-					continue;
-				} else {
-					Activator.getErrorLogger().logError("Ignoring unknown query component: " + queryPart, null);
-				}
-			} catch (NumberFormatException e) {
-				throw new MicaException("Invalid integer in query component: " + queryPart);
-			}
+		URIQueryParser parser = new URIQueryParser();
+		parser.run(getURIQueryDecoder(), uri.getQuery());
+		String[] unknownParts = parser.getUnknownQueryComponents();
+		if (unknownParts.length > 0) {
+			Activator.getErrorLogger().logError("Ignoring unknown query components in URI: " 
+					+ TextUtils.catenateStrings(unknownParts, "&"), null);
 		}
 	}
 	
 	/**
-	 * Decode a portion of the query URI.  
-	 * @param key
-	 * @param value
-	 * @return true if handled, false if not
+	 * Get the decoder for URI query components, which modifies the configuration accordingly.
+	 * @return IURIQueryDecoder, never <code>null</code>
 	 */
-	protected boolean decodeQueryPart(String key, String value) {
-		if (key.equals(SSH_HOST_ADDRESS)) {
-			sshConfiguration.setHostIPAddress(value);
-		} else if (key.equals(SSH_HOST_PORT)) {
-			sshConfiguration.setHostPort(Integer.parseInt(value));
-		} else if (key.equals(TIMEOUT)) {
-			sshConfiguration.setConnectionTimeout(Integer.parseInt(value));
-		} else if (key.equals(CIFS_PORT)) {
-			this.cifsPort = Integer.parseInt(value);
-		} else if (key.equals(COMMAND_LAUNCH_PATTERN)) {
-			this.commandLaunchPattern = value;
-		} else if (key.equals(EXECUTABLE)) {
-			this.executable = value;
-		} else {
-			return false;
-		}
-		return true;
-	}
+	protected abstract IURIQueryDecoder getURIQueryDecoder();
+	
 
 	/**
 	 * 
 	 */
 	protected void setupDefaults() {
-		this.sshConfiguration.setConnectionTimeout(1);
+		this.sshConfiguration.setConnectionTimeout(5);
 		this.executable = null;
 		this.commandLaunchPattern = null; 
 		this.cifsPort = 445;

Modified: trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java
===================================================================
--- trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -66,8 +66,7 @@
 				getTargetAddr(), getTargetPort(),
 				getHostAddr(), 22,
 				getUserName(), getUserPassword(),
-				10 /*timeout*/ 
-				);
+				10 /*timeout*/);
 
 		return sshConfiguration;
 	}

Modified: trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
===================================================================
--- trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -476,7 +476,7 @@
 									machine,
 									new SubProgressMonitor(monitor, 1));
 							if (!status.isOK()) {
-								Activator.getErrorLogger().logError(status.getMessage(), status.getException());
+								Activator.getErrorLogger().log(status);
 							}
 							// TODO we just log warnings instead of passing them back, otherwise "status.isOK()" checks everywhere fail
 							if (status.getSeverity() == IStatus.WARNING)

Copied: trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineURIQueryDecoder.java (from rev 1058, branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineURIQueryDecoder.java)
===================================================================
--- trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineURIQueryDecoder.java	                        (rev 0)
+++ trunk/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineURIQueryDecoder.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.api.vm.core;
+
+import org.maemo.mica.common.core.IURIQueryDecoder;
+import org.maemo.mica.common.core.machine.IMachineFactory;
+
+/**
+ * URI decoder for the common shared URI components 
+ * @author eswartz
+ * @see IMachineFactory#createMachine(String, java.net.URI, org.maemo.mica.common.core.machine.ISharedFilesystemProvider)
+ *
+ */
+public class BaseVirtualMachineURIQueryDecoder implements IURIQueryDecoder {
+	private static final String SSH_HOST_ADDRESS = "sshHostAddress";
+	private static final String SSH_HOST_PORT = "sshHostPort";
+	private static final String TIMEOUT = "timeout";
+	private static final String CIFS_PORT = "cifsPort";
+	private static final String COMMAND_LAUNCH_PATTERN = "commandLaunchPattern";
+	private static final String EXECUTABLE = "executable";
+	protected BaseCustomVirtualMachineConfiguration config;
+	
+	public BaseVirtualMachineURIQueryDecoder(BaseCustomVirtualMachineConfiguration config) {
+		this.config = config;
+	}
+	/**
+	 * Decode a portion of the query URI.  
+	 * @param key
+	 * @param value
+	 * @return true if handled, false if not
+	 */
+	public boolean decode(String key, String value) {
+		if (key.equals(SSH_HOST_ADDRESS)) {
+			config.sshConfiguration.setHostIPAddress(value);
+		} else if (key.equals(SSH_HOST_PORT)) {
+			config.sshConfiguration.setHostPort(Integer.parseInt(value));
+		} else if (key.equals(TIMEOUT)) {
+			config.sshConfiguration.setConnectionTimeout(Integer.parseInt(value));
+		} else if (key.equals(CIFS_PORT)) {
+			config.cifsPort = Integer.parseInt(value);
+		} else if (key.equals(COMMAND_LAUNCH_PATTERN)) {
+			config.commandLaunchPattern = value;
+		} else if (key.equals(EXECUTABLE)) {
+			config.executable = value;
+		} else {
+			return false;
+		}
+		return true;
+	}
+}

Modified: trunk/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/CustomQemuConfiguration.java
===================================================================
--- trunk/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/CustomQemuConfiguration.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/CustomQemuConfiguration.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -10,8 +10,9 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.vm.qemu;
 
-import org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration;
+import org.maemo.esbox.internal.api.vm.core.*;
 import org.maemo.esbox.vm.qemu.IQemuConfiguration;
+import org.maemo.mica.common.core.IURIQueryDecoder;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
 
@@ -24,15 +25,11 @@
  *
  */
 public class CustomQemuConfiguration extends BaseCustomVirtualMachineConfiguration implements IQemuConfiguration {
-	
-	private static final String INSTALL_PATH = "installPath";
-	private static final String DISK_IMAGE_PATHS = "diskImagePaths";
-	private static final String MEMORY_SIZE = "memorySize";
-	
-	private String installPath;
-	private String diskImagePaths;
-	private int memorySize;
 
+	protected String installPath;
+	protected String diskImagePaths;
+	protected int memorySize;
+
 	public CustomQemuConfiguration(URI uri, ISharedFilesystemProvider sharedFilesystemProvider) throws MicaException {
 		super(uri, sharedFilesystemProvider);
 	}	
@@ -50,22 +47,35 @@
 	}
 		
 	/* (non-Javadoc)
-	 * @see org.maemo.esbox.internal.vm.qemu.BaseCustomVirtualMachineConfiguration#decodeQueryPart(java.lang.String, java.lang.String)
+	 * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#getURIQueryDecoder()
 	 */
 	@Override
-	protected boolean decodeQueryPart(String key, String value) {
-		if (super.decodeQueryPart(key, value))
-			return true;
-		if (key.equals(INSTALL_PATH)) {
-			this.installPath = value;
-		} else if (key.equals(DISK_IMAGE_PATHS)) {
-			this.diskImagePaths = value;
-		} else if (key.equals(MEMORY_SIZE)) {
-			this.executable = value;
-		} else {
-			return false;
-		}
-		return true;
+	protected IURIQueryDecoder getURIQueryDecoder() {
+		return new BaseVirtualMachineURIQueryDecoder(this) {
+			
+			private static final String INSTALL_PATH = "installPath";
+			private static final String DISK_IMAGE_PATHS = "diskImagePaths";
+			private static final String MEMORY_SIZE = "memorySize";
+
+			/* (non-Javadoc)
+			 * @see org.maemo.esbox.internal.vm.qemu.BaseCustomVirtualMachineConfiguration#decodeQueryPart(java.lang.String, java.lang.String)
+			 */
+			@Override
+			public boolean decode(String key, String value) {
+				if (super.decode(key, value))
+					return true;
+				if (key.equals(INSTALL_PATH)) {
+					CustomQemuConfiguration.this.installPath = value;
+				} else if (key.equals(DISK_IMAGE_PATHS)) {
+					CustomQemuConfiguration.this.diskImagePaths = value;
+				} else if (key.equals(MEMORY_SIZE)) {
+					CustomQemuConfiguration.this.executable = value;
+				} else {
+					return false;
+				}
+				return true;
+			}
+		};
 	}
 	
 	public String getInstallPath() {

Modified: trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java	2008-12-12 01:59:14 UTC (rev 1058)
+++ trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/CustomVMwareConfiguration.java	2008-12-12 02:39:48 UTC (rev 1059)
@@ -10,8 +10,9 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.vm.vmware;
 
-import org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration;
+import org.maemo.esbox.internal.api.vm.core.*;
 import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.IURIQueryDecoder;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
 
@@ -42,19 +43,27 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#decodeQueryPart(java.lang.String, java.lang.String)
+	 * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#getURIQueryDecoder()
 	 */
 	@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;
+	protected IURIQueryDecoder getURIQueryDecoder() {
+		return new BaseVirtualMachineURIQueryDecoder(this) {
+			/* (non-Javadoc)
+			 * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineURIQueryDecoder#decode(java.lang.String, java.lang.String)
+			 */
+			@Override
+			public boolean decode(String key, String value) {
+				if (super.decode(key, value))
+					return true;
+				
+				if (key.equals(VMX_PATH)) {
+					vmxPath = value;
+				} else {
+					return false;
+				}
+				return true;
+			}
+		};
 	}
 	
 	/* (non-Javadoc)



More information about the Esbox-commits mailing list