[Esbox-commits] r916 - in branches/sdkPlusSupport: . org.maemo.esbox.maemosdk.tests org.maemo.esbox.maemosdk.tests/.settings org.maemo.esbox.maemosdk.tests/META-INF org.maemo.esbox.maemosdk.tests/about_files org.maemo.esbox.maemosdk.tests/src org.maemo.esbox.maemosdk.tests/src/org org.maemo.esbox.maemosdk.tests/src/org/maemo org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands org.maemo.esbox.scratchbox.sb1 org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk org.maemo.esbox.scratchbox.sb2 org.maemo.esbox.scratchbox.sb2/conf org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/scratchbox/sb2/sdk

baranov at garage.maemo.org baranov at garage.maemo.org
Mon Nov 3 15:32:16 EET 2008


Author: baranov
Date: 2008-11-03 15:32:15 +0200 (Mon, 03 Nov 2008)
New Revision: 916

Added:
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.classpath
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.project
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.settings/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/META-INF/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about.html
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about_files/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about_files/epl-v10.html
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/build.properties
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/hs_err_pid6120.log
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/AllTests.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxMaemoSDKTestSuite.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxProductTestSuite.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestOProfileValgrindSupport.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestRunStandalone.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/AllTests.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseSb2Test.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseTest.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockCommandAbstractor.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncherFactory.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestCreateTargetCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGdbQemuCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGetCurrentTargetCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestResetTargetCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRootstrapCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSelectTargetCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowPathMappingSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowTargetCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSimpleCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapterFactory.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapterFactory.java
Removed:
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapterFactory.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateMaemoRootstrapSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateTargetSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetCurrentTargetSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetMaemoRootstrapLocationCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListCompilersSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListTargetsCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveMaemoRootstrapSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveTargetSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapterFactory.java
Modified:
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/plugin.xml
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1FileSystemMapping.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDKTarget.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/conf/sb2_prefs.xml
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/plugin.xml
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/AbstractSb2Command.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/scratchbox/sb2/sdk/IScratchbox2SDK.java
Log:
Implemented sdk+ support:
	+ start maemo;
	+ stop maemo;
	+ install rootstrap;
	+ remove rootstrap;
TBD:
	- process output to console;
	- run in maemo (not supported in current sdk+); 




Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.classpath
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.classpath	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.classpath	2008-11-03 13:32:15 UTC (rev 916)
@@ -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/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.project
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.project	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.project	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.maemo.esbox.scratchbox.tests</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/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,7 @@
+#Fri Oct 17 08:40:13 CDT 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/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,36 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Scratchbox Feature Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.scratchbox.tests
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.scratchbox.tests.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.mica.common.core;bundle-version="2.0.0",
+ org.maemo.mica.common.core.tests;bundle-version="2.0.0",
+ org.maemo.mica.maemosdk.core;bundle-version="2.0.0",
+ org.maemo.mica.maemosdk.ui;bundle-version="2.0.0",
+ org.junit4;bundle-version="4.3.1",
+ org.maemo.mica.cpp.project.core;bundle-version="2.0.0";visibility:=reexport,
+ org.maemo.mica.common.project.core;bundle-version="2.0.0";visibility:=reexport,
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.eclipse.cdt.ui;bundle-version="5.0.1",
+ org.maemo.mica.cpp.project.ui;bundle-version="2.0.0",
+ org.maemo.mica.common.analysis;bundle-version="2.0.0",
+ org.maemo.mica.protocol.ssh;bundle-version="2.0.0",
+ org.maemo.mica.common.launch;bundle-version="2.0.0",
+ org.maemo.mica.cpp.tests;bundle-version="2.0.0",
+ org.maemo.mica.protocol.tests;bundle-version="2.0.0",
+ org.maemo.mica.python.tests;bundle-version="2.0.0",
+ org.maemo.mica.linux.tests;bundle-version="2.0.0",
+ org.maemo.esbox.scratchbox.sb1;bundle-version="2.0.0";visibility:=reexport,
+ org.maemo.esbox.scratchbox.sb2;bundle-version="2.0.0";visibility:=reexport,
+ org.maemo.esbox.scratchbox.core;bundle-version="2.0.0";visibility:=reexport,
+ org.maemo.esbox.maemosdk.core;visibility:=reexport
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.internal.scratchbox.tests,
+ org.maemo.esbox.scratchbox.tests,
+ org.maemo.esbox.scratchbox.tests.commands

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about.html
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about.html	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about.html	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,16 @@
+<h3>About This Content</h3>
+
+<h3>ESbox</h3>
+
+<p><a href="http://esbox.garage.maemo.org/" target="_blank">ESbox</a> 
+is an Eclipse plug-in that helps programmers to develop applications for 
+maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming 
+languages. Maemo 4.x SDKs (and later) will be supported.
+</p>
+
+<h3>License</h3>
+
+<p>See <a href="about_files/epl-v10.html">Eclipse Public License Version 1.0 (&quot;EPL&quot;)</a>.
+</p>
+
+<address> &copy; Copyright 2007-2008 INdT. All rights reserved. </address>

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about_files/epl-v10.html
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about_files/epl-v10.html	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/about_files/epl-v10.html	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+  <o:Revision>2</o:Revision>
+  <o:TotalTime>3</o:TotalTime>
+  <o:Created>2004-03-05T23:03:00Z</o:Created>
+  <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+  <o:Pages>4</o:Pages>
+  <o:Words>1626</o:Words>
+  <o:Characters>9270</o:Characters>
+   <o:Lines>77</o:Lines>
+  <o:Paragraphs>18</o:Paragraphs>
+  <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+  <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+  <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+	{font-family:Tahoma;
+	panose-1:2 11 6 4 3 5 4 4 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{mso-style-parent:"";
+	margin:0in;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	mso-fareast-font-family:"Times New Roman";}
+p
+	{margin-right:0in;
+	mso-margin-top-alt:auto;
+	mso-margin-bottom-alt:auto;
+	margin-left:0in;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+	{mso-style-name:"Balloon Text";
+	margin:0in;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:8.0pt;
+	font-family:Tahoma;
+	mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+	{size:8.5in 11.0in;
+	margin:1.0in 1.25in 1.0in 1.25in;
+	mso-header-margin:.5in;
+	mso-footer-margin:.5in;
+	mso-paper-source:0;}
+div.Section1
+	{page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor (&quot;Commercial
+Contributor&quot;) hereby agrees to defend and indemnify every other
+Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
+costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/build.properties
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/build.properties	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/build.properties	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/hs_err_pid6120.log
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/hs_err_pid6120.log	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/hs_err_pid6120.log	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,219 @@
+#
+# An unexpected error has been detected by HotSpot Virtual Machine:
+#
+#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d7c76a8, pid=6120, tid=1360
+#
+# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode)
+# Problematic frame:
+# V  [jvm.dll+0x876a8]
+#
+
+---------------  T H R E A D  ---------------
+
+Current thread (0x0c497a20):  JavaThread "ErrorReader" daemon [_thread_in_vm, id=1360]
+
+siginfo: ExceptionCode=0xc0000005, writing address 0x10bacac8
+
+Registers:
+EAX=0x00003000, EBX=0x10bafc84, ECX=0x10bacac8, EDX=0x10b76060
+ESP=0x10bafad0, EBP=0x10bafb30, ESI=0x00000003, EDI=0x10bafac8
+EIP=0x6d7c76a8, EFLAGS=0x00010202
+
+Top of Stack: (sp=0x10bafad0)
+0x10bafad0:   0c4b8408 0c497a20 6d7c7551 08c46e60
+0x10bafae0:   0c497a20 0c4b83f8 6d795ec3 00000002
+0x10bafaf0:   6d795e65 0c4b8408 0c4b8408 6d80a2f6
+0x10bafb00:   0c4b8408 0c4b8404 0c497a20 10bafb48
+0x10bafb10:   6d80b5b1 0c4b83fc 0c4b8400 0c4b8404
+0x10bafb20:   0c4b8408 00000007 10bafc8c 00cc89c0
+0x10bafb30:   10bafb74 6d81fbb2 0000000a 00000000
+0x10bafb40:   10bafbe4 0c4b83f8 08c46e60 0c497a20 
+
+Instructions: (pc=0x6d7c76a8)
+0x6d7c7698:   89 6d 7c 18 e8 67 73 05 00 0f af c6 8b cf 2b c8
+0x6d7c76a8:   83 21 00 46 3b 35 ac 20 89 6d 7e e8 5f 5e c3 8b 
+
+
+Stack: [0x10b70000,0x10bb0000),  sp=0x10bafad0,  free space=254k
+Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
+V  [jvm.dll+0x876a8]
+V  [jvm.dll+0xdfbb2]
+V  [jvm.dll+0x8746a]
+V  [jvm.dll+0x871c7]
+V  [jvm.dll+0xa2048]
+V  [jvm.dll+0x1110d8]
+V  [jvm.dll+0x1110a6]
+C  [MSVCRT.dll+0x2a3b0]
+C  [kernel32.dll+0xb683]
+
+
+---------------  P R O C E S S  ---------------
+
+Java Threads: ( => current thread )
+=>0x0c497a20 JavaThread "ErrorReader" daemon [_thread_in_vm, id=1360]
+  0x0b9d2008 JavaThread "OutputReader" daemon [_thread_in_vm, id=1928]
+  0x0c515600 JavaThread "Connect thread 127.0.0.1 session" [_thread_in_native, id=2920]
+  0x0c47a7f0 JavaThread "ReaderThread" [_thread_in_native, id=3532]
+  0x0be58a70 JavaThread "Worker-5" [_thread_blocked, id=6100]
+  0x0be96288 JavaThread "Worker-4" [_thread_in_vm, id=2996]
+  0x0be58008 JavaThread "Worker-3" [_thread_blocked, id=2388]
+  0x0be96e60 JavaThread "WorkbenchTestable" [_thread_blocked, id=5580]
+  0x0bc97c60 JavaThread "Worker-2" [_thread_blocked, id=5460]
+  0x0bb4d8f8 JavaThread "Worker-1" [_thread_blocked, id=1624]
+  0x0c3258c0 JavaThread "Java indexing" daemon [_thread_blocked, id=1068]
+  0x0bc5d028 JavaThread "Worker-0" [_thread_blocked, id=4548]
+  0x0b272808 JavaThread "Start Level Event Dispatcher" daemon [_thread_blocked, id=3952]
+  0x0b1e7c78 JavaThread "Framework Event Dispatcher" daemon [_thread_blocked, id=3820]
+  0x00c91e78 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5328]
+  0x00c90c08 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3576]
+  0x00c90010 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=600]
+  0x00c8cbb0 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=4696]
+  0x00c8bec8 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=1088]
+  0x003887f0 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=2700]
+  0x00c7c090 JavaThread "Finalizer" daemon [_thread_blocked, id=2036]
+  0x00c7ac20 JavaThread "Reference Handler" daemon [_thread_blocked, id=4232]
+  0x00388638 JavaThread "main" [_thread_blocked, id=4380]
+
+Other Threads:
+  0x00c78158 VMThread [id=2424]
+  0x00c93838 WatcherThread [id=5724]
+
+VM state:not at safepoint (normal execution)
+
+VM Mutex/Monitor currently owned by a thread: None
+
+Heap
+ def new generation   total 3072K, used 410K [0x02cc0000, 0x03010000, 0x031a0000)
+  eden space 2752K,   5% used [0x02cc0000, 0x02ce44b0, 0x02f70000)
+  from space 320K,  82% used [0x02fc0000, 0x030025e8, 0x03010000)
+  to   space 320K,   0% used [0x02f70000, 0x02f70000, 0x02fc0000)
+ tenured generation   total 39716K, used 22943K [0x031a0000, 0x05869000, 0x06cc0000)
+   the space 39716K,  57% used [0x031a0000, 0x04807e20, 0x04808000, 0x05869000)
+ compacting perm gen  total 34560K, used 34441K [0x06cc0000, 0x08e80000, 0x0acc0000)
+   the space 34560K,  99% used [0x06cc0000, 0x08e626a8, 0x08e62800, 0x08e80000)
+No shared spaces configured.
+
+Dynamic libraries:
+0x00400000 - 0x0040d000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\javaw.exe
+0x7c900000 - 0x7c9b0000 	C:\WINNT\system32\ntdll.dll
+0x7c800000 - 0x7c8f5000 	C:\WINNT\system32\kernel32.dll
+0x77dd0000 - 0x77e6b000 	C:\WINNT\system32\ADVAPI32.dll
+0x77e70000 - 0x77f02000 	C:\WINNT\system32\RPCRT4.dll
+0x77fe0000 - 0x77ff1000 	C:\WINNT\system32\Secur32.dll
+0x7e410000 - 0x7e4a0000 	C:\WINNT\system32\USER32.dll
+0x77f10000 - 0x77f57000 	C:\WINNT\system32\GDI32.dll
+0x77c10000 - 0x77c68000 	C:\WINNT\system32\MSVCRT.dll
+0x10000000 - 0x1003e000 	C:\WINNT\system32\cahooknt.dll
+0x6d740000 - 0x6d8dd000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\client\jvm.dll
+0x76b40000 - 0x76b6d000 	C:\WINNT\system32\WINMM.dll
+0x6d300000 - 0x6d308000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\hpi.dll
+0x76bf0000 - 0x76bfb000 	C:\WINNT\system32\PSAPI.DLL
+0x6d400000 - 0x6d435000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\jdwp.dll
+0x6d710000 - 0x6d71c000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\verify.dll
+0x6d380000 - 0x6d39d000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\java.dll
+0x6d730000 - 0x6d73f000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\zip.dll
+0x6d290000 - 0x6d297000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\dt_socket.dll
+0x71ab0000 - 0x71ac7000 	C:\WINNT\system32\WS2_32.dll
+0x71aa0000 - 0x71aa8000 	C:\WINNT\system32\WS2HELP.dll
+0x751d0000 - 0x751ee000 	C:\WINNT\system32\wshbth.dll
+0x77920000 - 0x77a13000 	C:\WINNT\system32\SETUPAPI.dll
+0x71a50000 - 0x71a8f000 	C:\WINNT\System32\mswsock.dll
+0x76f20000 - 0x76f47000 	C:\WINNT\system32\DNSAPI.dll
+0x76fb0000 - 0x76fb8000 	C:\WINNT\System32\winrnr.dll
+0x76f60000 - 0x76f8c000 	C:\WINNT\system32\WLDAP32.dll
+0x76fc0000 - 0x76fc6000 	C:\WINNT\system32\rasadhlp.dll
+0x662b0000 - 0x66308000 	C:\WINNT\system32\hnetcfg.dll
+0x71a90000 - 0x71a98000 	C:\WINNT\System32\wshtcpip.dll
+0x6d540000 - 0x6d553000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\net.dll
+0x6d560000 - 0x6d569000 	C:\Program Files\Java\jdk1.5.0_12\jre\bin\nio.dll
+0x72000000 - 0x72014000 	C:\eclipse-3.4.1\eclipse\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731\eclipse_1115.dll
+0x5d090000 - 0x5d12a000 	C:\WINNT\system32\COMCTL32.dll
+0x77c00000 - 0x77c08000 	C:\WINNT\system32\VERSION.dll
+0x0ce80000 - 0x0ced5000 	C:\sources\maemo-eclipse\.metadata\.plugins\org.eclipse.pde.core\pde-junit\org.eclipse.osgi\bundles\101\1\.cp\swt-win32-3449.dll
+0x774e0000 - 0x7761d000 	C:\WINNT\system32\ole32.dll
+0x77120000 - 0x771ab000 	C:\WINNT\system32\OLEAUT32.dll
+0x763b0000 - 0x763f9000 	C:\WINNT\system32\comdlg32.dll
+0x77f60000 - 0x77fd6000 	C:\WINNT\system32\SHLWAPI.dll
+0x773d0000 - 0x774d3000 	C:\WINNT\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\COMCTL32.dll
+0x7c9c0000 - 0x7d1d7000 	C:\WINNT\system32\SHELL32.dll
+0x76390000 - 0x763ad000 	C:\WINNT\system32\IMM32.dll
+0x74d90000 - 0x74dfb000 	C:\WINNT\system32\USP10.dll
+0x771b0000 - 0x7725a000 	C:\WINNT\system32\WININET.dll
+0x77a80000 - 0x77b14000 	C:\WINNT\system32\CRYPT32.dll
+0x77b20000 - 0x77b32000 	C:\WINNT\system32\MSASN1.dll
+0x5ad70000 - 0x5ada8000 	C:\WINNT\system32\uxtheme.dll
+0x74720000 - 0x7476b000 	C:\WINNT\system32\MSCTF.dll
+0x63000000 - 0x63014000 	C:\WINNT\system32\SynTPFcs.dll
+0x0d520000 - 0x0d534000 	C:\sources\maemo-eclipse\.metadata\.plugins\org.eclipse.pde.core\pde-junit\org.eclipse.osgi\bundles\101\1\.cp\swt-gdip-win32-3449.dll
+0x4ec50000 - 0x4edf6000 	C:\WINNT\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.3352_x-ww_81af8e88\gdiplus.dll
+0x74c80000 - 0x74cac000 	C:\WINNT\system32\oleacc.dll
+0x76080000 - 0x760e5000 	C:\WINNT\system32\MSVCP60.dll
+0x20000000 - 0x202c5000 	C:\WINNT\system32\xpsp2res.dll
+0x76fd0000 - 0x7704f000 	C:\WINNT\system32\CLBCATQ.DLL
+0x77050000 - 0x77115000 	C:\WINNT\system32\COMRes.dll
+0x7e290000 - 0x7e401000 	C:\WINNT\system32\shdocvw.dll
+0x754d0000 - 0x75550000 	C:\WINNT\system32\CRYPTUI.dll
+0x76c30000 - 0x76c5e000 	C:\WINNT\system32\WINTRUST.dll
+0x76c90000 - 0x76cb8000 	C:\WINNT\system32\IMAGEHLP.dll
+0x5b860000 - 0x5b8b4000 	C:\WINNT\system32\NETAPI32.dll
+0x77b40000 - 0x77b62000 	C:\WINNT\system32\appHelp.dll
+0x75e90000 - 0x75f40000 	C:\WINNT\system32\SXS.DLL
+0x0e450000 - 0x0e716000 	C:\WINNT\system32\msi.dll
+0x7e1e0000 - 0x7e282000 	C:\WINNT\system32\urlmon.dll
+0x0e780000 - 0x0e808000 	C:\WINNT\system32\shdoclc.dll
+0x7dc30000 - 0x7df23000 	C:\WINNT\system32\mshtml.dll
+0x746c0000 - 0x746e7000 	C:\WINNT\system32\msls31.dll
+0x75cf0000 - 0x75d81000 	C:\WINNT\system32\MLANG.dll
+0x76380000 - 0x76385000 	C:\WINNT\system32\msimg32.dll
+0x746f0000 - 0x7471a000 	C:\WINNT\system32\msimtf.dll
+0x75c50000 - 0x75cbf000 	C:\WINNT\system32\jscript.dll
+0x6bdd0000 - 0x6be06000 	C:\WINNT\system32\dxtrans.dll
+0x76b20000 - 0x76b31000 	C:\WINNT\system32\ATL.DLL
+0x0f8e0000 - 0x0f8ea000 	C:\WINNT\system32\ddrawex.dll
+0x73760000 - 0x737a9000 	C:\WINNT\system32\DDRAW.dll
+0x73bc0000 - 0x73bc6000 	C:\WINNT\system32\DCIMAN32.dll
+0x6be10000 - 0x6be6a000 	C:\WINNT\system32\dxtmsft.dll
+0x66880000 - 0x6688c000 	C:\WINNT\system32\IMGUTIL.DLL
+0x5e310000 - 0x5e31c000 	C:\WINNT\system32\pngfilt.dll
+0x0fea0000 - 0x0feaf000 	C:\sources\maemo-eclipse\.metadata\.plugins\org.eclipse.pde.core\pde-junit\org.eclipse.osgi\bundles\149\1\.cp\jWinHttp.dll
+0x4d4f0000 - 0x4d548000 	C:\WINNT\system32\WINHTTP.dll
+0x104f0000 - 0x10518000 	C:\WINNT\system32\rsaenh.dll
+0x769c0000 - 0x76a73000 	C:\WINNT\system32\USERENV.dll
+0x0b5c0000 - 0x0b5c8000 	C:\sources\maemo-eclipse\.metadata\.plugins\org.eclipse.pde.core\pde-junit\org.eclipse.osgi\bundles\83\1\.cp\os\win32\x86\localfile_1_0_0.dll
+0x6eec0000 - 0x6eee1000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libapr-1.dll
+0x106d0000 - 0x107da000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libeay32.dll
+0x71ad0000 - 0x71ad9000 	C:\WINNT\system32\WSOCK32.dll
+0x13000000 - 0x130c4000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libdb44.dll
+0x10670000 - 0x106a1000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\ssleay32.dll
+0x6ee60000 - 0x6ee8a000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libaprutil-1.dll
+0x107e0000 - 0x107f2000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\intl3_svn.dll
+0x10800000 - 0x10915000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\dbghelp.dll
+0x10a20000 - 0x10a72000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libsvn_subr-1.dll
+0x76780000 - 0x76789000 	C:\WINNT\system32\SHFOLDER.dll
+0x10a80000 - 0x10a96000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libsvn_delta-1.dll
+0x10aa0000 - 0x10aad000 	C:\eclipse-3.4.1\eclipse\plugins\org.tigris.subversion.clientadapter.javahl.win32_1.5.3\libsvn_diff-1.dll
+
+VM Arguments:
+jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:1101 -Declipse.pde.launch=true -Declipse.p2.data.area=@config.dir\p2 -Dfile.encoding=Cp1252
+java_command: org.eclipse.equinox.launcher.Main -os win32 -ws win32 -arch x86 -nl en_US -version 3 -port 1100 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.maemo.esbox.scratchbox.tests.ESboxProductTestSuite -application org.eclipse.pde.junit.runtime.uitestapplication -product org.eclipse.sdk.ide -data C:\sources\maemo-eclipse/../junit-workspace -configuration file:C:/sources/maemo-eclipse/.metadata/.plugins/org.eclipse.pde.core/pde-junit/ -dev file:C:/sources/maemo-eclipse/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os win32 -ws win32 -arch x86 -nl en_US -testpluginname org.maemo.esbox.scratchbox.tests
+Launcher Type: SUN_STANDARD
+
+Environment Variables:
+CLASSPATH=.;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
+PATH=C:\Program Files\Java\jdk1.5.0_12\jre\bin;C:/Program Files/Java/jre1.6.0_03/bin/client;C:/Program Files/Java/jre1.6.0_03/bin;C:\Program Files\Common Files\Symbian\Tools;C:\Program Files\PC Connectivity Solution\;c:\apps\rvct22_616\bin;4.553193E+219POCROOT4.556791e+219poc32\tools;9.080440E-315POCROOT3.931419e+219poc32\gcc\bin;C:\Perl\bin\;C:\Program Files\ThinkPad\Utilities;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;c:\Program Files\ATI Technologies\ATI.ACE\;C:\Program Files\Intel\Wireless\Bin;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\Nokia\CodeWarrior for Symbian v3.1\Bin;C:\Symbian\UIQ3.1SDK\epoc32\tools\nokia_compiler\Symbian_Tools\Command_Line_Tools;C:\PROGRA~1\PuTTY;C:\Program Files\QuickTime\QTSystem\;
+USERNAME=eswartz
+OS=Windows_NT
+PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel
+
+
+
+---------------  S Y S T E M  ---------------
+
+OS: Windows XP Build 2600 Service Pack 2
+
+CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 15 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2
+
+Memory: 4k page, physical 2095448k(360176k free), swap 1942156k(5192k free)
+
+vm_info: Java HotSpot(TM) Client VM (1.5.0_12-b04) for windows-x86, built on May  2 2007 02:07:59 by "java_re" with MS VC++ 6.0
+

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/scratchbox/tests/Activator.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.scratchbox.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * 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.scratchbox.tests";
+
+	// 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;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/AllTests.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/AllTests.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/AllTests.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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.scratchbox.tests;
+
+import junit.framework.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for org.maemo.esbox.scratchbox.tests");
+		suite.addTest(new JUnit4TestAdapter(TestOProfileValgrindSupport.class));
+		//$JUnit-BEGIN$
+		suite.addTestSuite(TestSB2ProcessLauncher.class);
+		suite.addTestSuite(TestSB1ProcessLauncher.class);
+		suite.addTestSuite(TestSB2SDKProvider.class);
+		suite.addTestSuite(TestProcessLauncher.class);
+		suite.addTestSuite(TestSB1SDKProvider.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxMaemoSDKTestSuite.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxMaemoSDKTestSuite.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxMaemoSDKTestSuite.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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.scratchbox.tests;
+
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxMaemoSDKTestSuite {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for org.maemo.esbox.internal.scratchbox.tests");
+		
+		suite.addTest(org.maemo.esbox.scratchbox.tests.AllTests.suite());
+		suite.addTest(org.maemo.esbox.scratchbox.tests.commands.AllTests.suite());
+		//$JUnit-BEGIN$
+
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxProductTestSuite.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxProductTestSuite.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/ESboxProductTestSuite.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.*;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * We place this suite here since the maemo SDK tests usually depend on
+ * most of these other features anyway.  (The alternative is to make a new
+ * org.maemo.esbox.product.tests plugin.)
+ * @author eswartz
+ *
+ */
+public class ESboxProductTestSuite {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for ESbox Product");
+		
+		for (IBuildMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			try {
+				MachineUtils.acquireMachine(machine);
+			} catch (MicaException e) {
+			}
+		}
+		
+		suite.addTest(org.maemo.mica.common.core.tests.MicaCoreTestSuite.suite());
+		suite.addTest(org.maemo.esbox.scratchbox.tests.ESboxMaemoSDKTestSuite.suite());
+		suite.addTest(org.maemo.mica.linux.tests.MicaLinuxTestSuite.suite());
+		suite.addTest(org.maemo.mica.cpp.tests.MicaCppTestSuite.suite());
+		suite.addTest(org.maemo.mica.python.tests.MicaPythonTestSuite.suite());
+		suite.addTest(org.maemo.mica.protocol.tests.MicaDeviceTestSuite.suite());
+		//$JUnit-BEGIN$
+
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestOProfileValgrindSupport.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestOProfileValgrindSupport.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestOProfileValgrindSupport.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.mica.common.analysis.adapters.IOProfileSupportAdapter;
+import org.maemo.mica.common.analysis.adapters.IValgrindSupportAdapter;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.internal.api.protocol.ssh.DeviceSSHLinuxMachine;
+import org.maemo.mica.protocol.ssh.SSHConfiguration;
+
+
+/**
+ * Test that the OProfile and Valgrind adapter support is wired up properly.  
+ * @author eswartz
+ *
+ */
+public class TestOProfileValgrindSupport {
+	@Test
+	public void testSbox() throws Exception {
+		
+		ISDKTarget armelTarget = null;
+		
+		for (ISDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+			IOProfileSupportAdapter oprofileSupport = (IOProfileSupportAdapter) sdkTarget.getAdapter(IOProfileSupportAdapter.class);
+			IValgrindSupportAdapter valgrindSupportAdapter = (IValgrindSupportAdapter) sdkTarget.getAdapter(IValgrindSupportAdapter.class);
+			if (sdkTarget.getPlatform().getName().toLowerCase().matches("chinook|diablo|fremantle")) {
+				assertNotNull(sdkTarget.getName(), oprofileSupport);
+				assertNotNull(sdkTarget.getName(), valgrindSupportAdapter);
+				
+				IMachine machine = sdkTarget.getSDK().getMachine();
+				if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+					armelTarget = sdkTarget;
+					assertNotNull(oprofileSupport.validateSupport(machine));	// not a device
+					assertNotNull(valgrindSupportAdapter.validateSupport(machine));	// no ARMEL port of valgrind known
+				} else if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_X86)) {
+					assertNotNull(oprofileSupport.validateSupport(machine));	// not a device
+					assertNull(valgrindSupportAdapter.validateSupport(machine));
+				}
+			}
+		}
+
+		if (armelTarget != null) {
+			SSHConfiguration sshConfig = new SSHConfiguration();
+			IMachine machine = new DeviceSSHLinuxMachine("foo", sshConfig, null); 
+			
+			IOProfileSupportAdapter oprofileSupport = (IOProfileSupportAdapter) armelTarget.getAdapter(IOProfileSupportAdapter.class);
+			IValgrindSupportAdapter valgrindSupportAdapter = (IValgrindSupportAdapter) armelTarget.getAdapter(IValgrindSupportAdapter.class);
+			
+			assertNotNull(oprofileSupport);
+			assertNotNull(valgrindSupportAdapter);
+			
+			assertNotNull(valgrindSupportAdapter.validateSupport(machine));  // no ARMEL port of valgrind known
+			assertNull(oprofileSupport.validateSupport(machine));  // device launch
+		}
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestProcessLauncher.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestProcessLauncher.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,454 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.env.EnvironmentManager;
+import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
+import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.sdk.ISDK;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.tests.core.BaseTest;
+import org.maemo.mica.internal.api.common.core.sdk.HostSDK;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test the generic IProcessLauncher interface.
+ * This test is extended by SDK-specific tests which override
+ * #getSDKs() to test these basic tests on different SDKs.
+ * @author eswartz
+ *
+ */
+public class TestProcessLauncher extends BaseTest {
+
+	private static final int MAX_TARGETS = 2;
+	private Process theProcess;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+	
+	protected List<ISDK> getSDKs() throws MicaException {
+		ArrayList<ISDK> sdks = new ArrayList<ISDK>();
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			if (machine.getOS().equals(Platform.OS_LINUX))
+				sdks.add(new HostSDK(machine, "1.0.0", machine.getName()));
+		}
+		return sdks;
+	}
+
+	protected interface IRunner {
+		void run(ISDKTarget target) throws Exception;
+	}
+
+	protected void runOverTargets(IRunner runner) throws Exception {
+		boolean any = false;
+		for (ISDK sdk : getSDKs()) {
+			int count = MAX_TARGETS;
+			ISDKTarget[] targets = sdk.getSDKTargets();
+			for (ISDKTarget target : targets) {
+				if (target.getName().contains("libtool") 
+						|| target.getName().contains("REMOVE")
+						|| target.getName().contains("bora"))
+					continue;
+				if (!validateMachine(target.getSDK().getMachine()))
+					continue;
+				if (--count < 0)
+					break;
+				any = true;
+				runner.run(target);
+			}
+		}
+		assertTrue("No SDK targets found", any);
+
+	}
+
+	/** Make sure env vars are actually passed appropriately */
+	@Test
+	public void testEnvVars() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+
+				String cmdText = "echo $CC $LDFLAGS =$SPACEY= \"$LAST\" $LANG$MAIL$IFS .";
+				IEnvironmentModifierBlock envVarBlock = EnvironmentManager.getInstance().createEnvironmentModifierBlock();
+				envVarBlock.define("CC", "gcc");
+				envVarBlock.define("LDFLAGS", "-lm");
+				envVarBlock.define("SPACEY", "-a -b larry's -d");	// the ' should not cause a problem
+				envVarBlock.define("LAST", "*");  // this should not be expanded
+				envVarBlock.undefine("LANG");
+				envVarBlock.undefine("MAIL");
+				envVarBlock.undefine("IFS");
+				
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, envVarBlock);
+
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target.getName() + ": " + err.toString(), 0, exit);	// some targets can't handle export $@
+				assertEquals("", err.toString());
+				assertStdTextEquals("gcc -lm =-a -b larry's -d= * .\n", out.toString());
+			}
+
+		});
+	}
+
+	/** Make sure env vars are not lost entirely when passing null envBlock */
+	@Test
+	public void testEnvVars2() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+
+				String cmdText = "echo $PATH";
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, null);
+
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target+":\n"+err.toString(), 0, exit);
+
+				assertEquals("", err.toString());
+				assertTrue(out.toString().contains(":"));
+			}
+
+		});
+	}
+	/** Test launching and consuming output */
+	@Test
+	public void testStreamParsing() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				String cmdText = "echo stdout1 ; echo stderr1 1>&2 ; "
+						+ "echo stdout2 ; echo stderr2 1>&2 ; "
+						+ "echo stdout3 ; echo stderr3 1>&2 ; "
+						+ "echo stdout4 ; echo stderr4 1>&2 ; " + "";
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, null);
+
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target+":\n"+err.toString(), 0, exit);
+
+				assertStdTextEquals("stderr1\nstderr2\nstderr3\nstderr4\n", err
+						.toString());
+				assertStdTextEquals("stdout1\nstdout2\nstdout3\nstdout4\n", out
+						.toString());
+
+			}
+		});
+	}
+
+	/** Make sure the stream I/O works */
+	@Test
+	public void testStreamHandling2() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				String cmdText = "sed s/from/to/g";
+				
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, null);
+
+				theProcess.getOutputStream().write("this is from home\nwhere is it from?\n".getBytes());
+				theProcess.getOutputStream().close();
+				
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(0, exit);
+				
+				// some sdks don't have sed
+				if (!err.toString().contains("command not found")) {
+					assertEquals("", err.toString());
+					assertStdTextEquals("this is to home\nwhere is it to?\n", out.toString());
+				}
+				
+			}
+		});
+		
+	}
+	/**
+	 * @param target SDK target to use
+	 * @param cwd target-relative CWD or null
+	 * @param cmdText text to copy into script
+	 * @param envVarBlock environment variables
+	 * @param pty pty or null
+	 * @return new process launcher
+	 */
+	IProcessLauncher createAndLaunchStockProcessForScript(
+			ISDKTarget target, IPath cwd, String cmdText, IEnvironmentModifierBlock envVarBlock)
+			throws Exception {
+		IProcessLauncherFactory processLauncherFactory = target
+				.getProcessLauncherFactory();
+
+		return createAndLaunchStockProcessForScript(
+				processLauncherFactory,
+				target, cwd, cmdText,
+				envVarBlock);
+	}
+
+	IProcessLauncher createAndLaunchStockProcessForScript(IProcessLauncherFactory processLauncherFactory,
+			ISDKTarget target, IPath cwd, String cmdText, IEnvironmentModifierBlock envVarBlock)
+			throws Exception {
+		IPath scriptPath = createStockScript(target, cmdText);
+
+		// System.out.println(cmdline);
+		List<String> cmdLine = CommandLineArguments.createFromCommandLine(scriptPath.toPortableString());
+		IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+				processLauncherFactory, cwd, 
+				CommandLineArguments.wrapScriptCommandLineForShell(cmdLine),
+				envVarBlock);
+		// System.out.println(processLauncher.getLaunchCommandArguments().toCommandLine());
+
+		theProcess = processLauncher.createProcess();
+		return processLauncher;
+	}
+
+	private IPath createStockScript(ISDKTarget target, String cmdText)
+			throws Exception {
+		
+		IPath scriptPath = target.getSDK().getMachine().getUserHome().append(".tmp").append("foo.sh");
+		IPath targetPath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(scriptPath);
+		target.getTargetFileSystemAccess().getFileStore(targetPath.removeLastSegments(1)).mkdir(0, null);
+		
+		IFileStore fileStore = target.getTargetFileSystemAccess().getFileStore(targetPath);
+		OutputStream fos = fileStore.openOutputStream(
+				EFS.NONE, new NullProgressMonitor());
+		fos.write(("#!/bin/sh\n" + cmdText).getBytes());
+		fos.close();
+		
+		FileInfo info = new FileInfo(fileStore.getName());
+		info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
+		fileStore.putInfo(info, EFS.SET_ATTRIBUTES, null);
+		
+		return scriptPath;
+	}
+
+	/** Test launching and failing */
+	@Test
+	public void testFailure() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "/non/existent/program -i -c -e");
+
+				// depending on the level of SDK, we may either get an exception
+				// or a process which fails
+				try {
+					Process process = processLauncher.createProcess();
+					processLauncher.waitAndRead(new ByteArrayOutputStream(),
+							new ByteArrayOutputStream());
+					int exit = process.exitValue();
+					assertTrue(exit != 0);
+				} catch (MicaException e) {
+					// expected
+				}
+			}
+		});
+	}
+
+	/** Test launching and succeeding with a bad exit code */
+	@Test
+	public void testNonZeroExit() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "false");
+
+				Process process = processLauncher.createProcess();
+				processLauncher.waitAndRead(new ByteArrayOutputStream(),
+						new ByteArrayOutputStream());
+				int exit = process.exitValue();
+				assertEquals(1, exit);
+			}
+		});
+	}
+
+	/** Make sure the cwd is actually passed appropriately */
+	@Test
+	public void testCWD() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				String cmdText = "pwd";
+
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, new Path("/usr/games"), cmdText, null);
+
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target+":\n"+err.toString(), 0, exit);
+
+				assertStdTextEquals("", err.toString());
+				assertEquals(target.getName(), "/usr/games", out.toString().trim());
+
+			}
+		});
+	}
+	
+	/** Make sure the PTY variant works */
+	@Test
+	public void testPTY() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				String cmdText = "sed s/from/to/g";
+				
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, null);
+
+				theProcess.getOutputStream().write("this is from home\nwhere is it from?\n".getBytes());
+				theProcess.getOutputStream().close();
+				
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target+":\n"+err.toString(), 0, exit);
+				
+				// some sdks don't have sed
+				if (!err.toString().contains("command not found")) {
+					assertStdTextEquals("", err.toString());
+					assertStdTextEquals("this is to home\nwhere is it to?", out.toString().trim());
+				}
+				
+			}
+		});
+		
+	}
+	
+	/** Test that the Esbox environment variables are passed properly */
+	@Test
+	public void testEnvironmentDefaults() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				IEnvironmentModifierBlock globalBlock = EnvironmentManager.getInstance().getGlobalEnvironmentModifierBlock();
+				IEnvironmentModifierBlock envBlockOrig = globalBlock.copy();
+
+				try {
+					// DISPLAY comes from the .bashrc in scratchbox or from the X11 environment
+					globalBlock.clear();
+					
+					// set ESbox variables
+					globalBlock.define("ESBOXONLY", "fromesbox_original");
+					globalBlock.define("ESBOXOVERRIDE", "fromesbox_original");
+					globalBlock.define("DISPLAY", "esbox:3");
+					
+					// construct an environment that consists of overrides of the standard environment
+					IProcessLauncherFactory factory = target.getProcessLauncherFactory(); 
+					IEnvironmentModifierBlock envVarBlock = factory.defaultEnvironmentModifierBlock();
+					
+					assertNotNull(envVarBlock.findOperation("ESBOXONLY"));
+					assertNotNull(envVarBlock.findOperation("ESBOXOVERRIDE"));
+					assertNotNull(envVarBlock.findOperation("DISPLAY"));
+					
+					envVarBlock.define("ESBOXOVERRIDE", "launch_override");
+					envVarBlock.define("PASSEDIN", "launch_passedin");
+					
+					String cmdText = "echo $DISPLAY,$ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN\necho $USER\n";
+					IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+							factory, target, null, cmdText, envVarBlock);
+	
+					ByteArrayOutputStream out = new ByteArrayOutputStream();
+					ByteArrayOutputStream err = new ByteArrayOutputStream();
+					int exit = processLauncher.waitAndRead(out, err);
+					assertEquals(target+":\n"+err.toString(), 0, exit);
+	
+					assertStdTextEquals("", err.toString());
+					String[] lines = out.toString().trim().split("\r\n|\n");
+					assertEquals("esbox:3,fromesbox_original,launch_override,launch_passedin", lines[0]);
+					assertEquals(2, lines.length);
+					assertTrue(lines.length > 0);
+	
+					//////////
+	
+					// construct an environment that consists of a clean environment
+					envVarBlock = EnvironmentManager.getInstance().createEnvironmentModifierBlock(); 
+					envVarBlock.define("ESBOXOVERRIDE", "launch_override");
+					envVarBlock.define("PASSEDIN", "launch_passedin");
+					
+					cmdText = "echo $ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN";
+					processLauncher = createAndLaunchStockProcessForScript(
+							target, null, cmdText, envVarBlock);
+	
+					out = new ByteArrayOutputStream();
+					err = new ByteArrayOutputStream();
+					exit = processLauncher.waitAndRead(out, err);
+					assertEquals(target+":\n"+err.toString(), 0, exit);
+	
+					assertEquals("", err.toString());
+					assertStdTextEquals(",launch_override,launch_passedin\n", out.toString());
+				} finally {
+					EnvironmentManager.getInstance().getGlobalEnvironmentModifierBlock().clear();
+					EnvironmentManager.getInstance().getGlobalEnvironmentModifierBlock().apply(envBlockOrig);
+				}
+			}
+		});
+	}
+	
+	/**
+	 * If a process is launched with a different PATH, we must ensure to wrap the
+	 * command in a shell, or else PATH won't be used.
+	 * @throws Exception
+	 */
+	public void testLaunchWithAlternatePATH() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				IPath scriptPath = createStockScript(target, "echo hello\n");
+				
+				// make an overridden environment that has the script directory in its PATH
+				String scriptDir = scriptPath.removeLastSegments(1).toPortableString();
+				IEnvironmentModifierBlock envVarBlock =
+					ProcessLauncherUtils.addToPATH(target.getSDK().getMachine(),
+							target.getProcessLauncherFactory(), 
+							scriptDir, true);
+				
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+						target.getProcessLauncherFactory(),
+						null,
+						CommandLineArguments.createFromCommandLine(scriptPath.lastSegment()),
+						envVarBlock);
+				
+				processLauncher.createProcess();
+				
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(target+":\n"+err.toString(), 0, exit);
+				
+				assertStdTextEquals("hello\n", out.toString());
+			}
+		});
+	}
+}
\ No newline at end of file

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestRunStandalone.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestRunStandalone.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestRunStandalone.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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.scratchbox.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.mica.common.core.process.ProcessLauncherParameters;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.launch.adapters.IRunStandaloneAdapter;
+
+
+/**
+ * Test that the "run standalone" support is wired up properly.  
+ * @author eswartz
+ *
+ */
+public class TestRunStandalone {
+	@Test
+	public void testSbox() throws Exception {
+		for (ISDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+			IRunStandaloneAdapter support = (IRunStandaloneAdapter) sdkTarget.getAdapter(IRunStandaloneAdapter.class);
+			if (sdkTarget.getPlatform().getName().toLowerCase().matches("chinook|diablo|fremantle")) {
+				assertNotNull(sdkTarget.getName(), support);
+			} else {
+				continue;
+			}
+			assertEquals(true, support.getDefault());
+			assertNotNull(support.getLabelText());
+			assertNotNull(support.getTooltipText());
+			
+			ProcessLauncherParameters params = new ProcessLauncherParameters();
+			params.getCommandLine().add("ls");
+			
+			support.updateLaunch(params, false);
+			assertEquals(1, params.getCommandLine().size());
+			assertEquals("ls", params.getCommandLine().get(0));
+			
+			support.updateLaunch(params, true);
+			assertEquals(2, params.getCommandLine().size());
+			assertEquals("run-standalone.sh", params.getCommandLine().get(0));
+			assertEquals("ls", params.getCommandLine().get(1));
+		}
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.internal.scratchbox.sb1.provider.Scratchbox1SDKProvider;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.env.EnvironmentManager;
+import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.sdk.*;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets are properly detected,
+ * and that it launches processes in the expected way
+ * 
+ * @author eswartz
+ * 
+ */
+public class TestSB1ProcessLauncher extends TestProcessLauncher {
+	ISDKProvider sb1Provider;
+	private static List<ISDK> sdks;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		SDKFactory factory = SDKFactory.getInstance();
+
+		List<ISDKProvider> providers = factory.getSDKProviders();
+		assertNotNull(providers);
+
+		// don't worry if we don't find an SB1 installation
+		// on this host (this is mostly a manual test)
+		for (ISDKProvider provider : providers) {
+			if (provider instanceof Scratchbox1SDKProvider) {
+				sb1Provider = provider;
+				break;
+			}
+		}
+
+		if (sb1Provider == null && !Platform.isRunning()) {
+			// in case of standalone test
+			sb1Provider = new Scratchbox1SDKProvider();
+		}
+
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected List<ISDK> getSDKs() throws MicaException {
+		if (sdks == null) {
+			if (sb1Provider == null)
+				sdks = Collections.EMPTY_LIST;
+			else
+				sdks = sb1Provider.createSDKs();
+		}
+		return sdks;
+	}
+
+	/** Make sure commands are assembled appropriately */
+	@Test
+	public void testSB1ProcessLauncherAssembly() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+						processLauncherFactory, "ls");
+				List<String> args = processLauncher.getLaunchCommandArguments();
+				assertNotNull(args);
+
+				// be sure no variables are left unexpanded
+				assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+				// assume the pattern is still /scratchbox/login ... 
+				assertEquals("/scratchbox/login", args.get(0));
+			}
+		});
+	}
+
+	/** Make sure arguments appear to be passed appropriately */
+	@Test
+	public void testSB1ProcessLauncherArguments() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IEnvironmentModifierBlock envVars = EnvironmentManager.getInstance().createEnvironmentModifierBlock();
+				envVars.define("CC", "gcc");
+				envVars.define("LDFLAGS", "-lm");
+				envVars.define("SPACEY", "a b c");
+				envVars.define("WILD", "*");
+				envVars.undefine("FOOBAR");
+				IPath tempPath = new Path("/tmp");
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory,
+						tempPath, 
+						"./configure", CommandLineArguments.createFromVarArgs(
+								"--enable-maintainer-mode",
+								"--disable-gtk"), envVars);
+
+				// the env vars are encoded into run.sh, not passed outside the
+				// process
+				IEnvironmentModifierBlock launchEnvironment = processLauncher
+						.getLaunchEnvironmentModifierBlock();
+				assertNull(launchEnvironment);
+
+				List<String> args = processLauncher.getLaunchCommandArguments();
+				assertNotNull(args);
+
+				// be sure no variables are left unexpanded
+				assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+				// assume the pattern is still /scratchbox/login -d ...
+				// ".../run.sh ... \".... <command>\""
+				// (basically verifying the command is wrapped)
+				assertEquals("/scratchbox/login", args.get(0));
+				String last = args.get(args.size() - 1);
+				// System.out.println(last);
+				assertEquals(
+						"./run.sh " + tempPath.toPortableString() + " \\\"CC=gcc,LDFLAGS=-lm,SPACEY=a b c,WILD=*,-FOOBAR\\\" \\\"./configure --enable-maintainer-mode --disable-gtk\\\"",
+						last);
+
+			}
+		});
+	}
+
+	
+	/** Test that the Esbox environment variables are passed properly. */
+	@Test
+	public void testEnvironmentPassingSb1() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				IEnvironmentModifierBlock envVars = EnvironmentManager.getInstance().createEnvironmentModifierBlock();
+				
+				envVars.define("DISPLAY", ":2");
+				envVars.define("ESBOXOVERRIDE", "launch_override");
+				envVars.define("PASSEDIN", "launch_passedin");
+				
+				String cmdText = "echo $DISPLAY,$ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN";
+				IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+						target, null, cmdText, envVars);
+
+				ByteArrayOutputStream out = new ByteArrayOutputStream();
+				ByteArrayOutputStream err = new ByteArrayOutputStream();
+				int exit = processLauncher.waitAndRead(out, err);
+				assertEquals(0, exit);
+
+				assertEquals("", err.toString());
+				assertEquals(":2,,launch_override,launch_passedin", out.toString().trim());
+
+			}
+		});
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.internal.scratchbox.sb1.provider.Scratchbox1SDKProvider;
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.ILocalMachine;
+import org.maemo.mica.common.core.sdk.*;
+import org.maemo.mica.common.core.tests.core.BaseTest;
+
+import java.util.List;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets
+ * are properly detected, and that it launches processes
+ * in the expected way
+ * @author eswartz
+ *
+ */
+public class TestSB1SDKProvider extends BaseTest {
+	private ISDKProvider sb1Provider;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		SDKFactory factory = SDKFactory.getInstance();
+
+		List<ISDKProvider> providers = factory.getSDKProviders();
+		assertNotNull(providers);
+		
+		// don't worry if we don't find an SB1 installation
+		// on this host (this is mostly a manual test)
+		for (ISDKProvider provider : providers) {
+			if (provider instanceof Scratchbox1SDKProvider) {
+				sb1Provider = provider;
+				break;
+			}
+		}
+		
+		if (sb1Provider == null && !Platform.isRunning()) {
+			// in case of standalone test
+			sb1Provider = new Scratchbox1SDKProvider();
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see junit.framework.TestCase#tearDown()
+	 */
+	@Override
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		
+	}
+	
+	@Test
+	public void testSB1SDKProvider() throws Exception {
+		if (sb1Provider == null)
+			return;
+		
+		List<ISDK> sdks = sb1Provider.createSDKs();
+		assertNotNull(sdks);
+		
+		for (ISDK sdk : sdks) {
+			// the name mentions the scratchbox name and version
+			assertEquals("Scratchbox 1", sdk.getName());
+			assertTrue(sdk.getVersion().matches("1\\.0\\.\\d+"));
+			IPath root = sdk.getSDKRoot();
+			assertTrue(sdk.getMachineFileSystemAccess().getFileStore(root).fetchInfo().exists());
+			assertTrue(root.toPortableString().startsWith("/scratchbox/"));
+		}
+	}
+	
+	@Test
+	public void testSB1SDKTargets() throws Exception {
+		if (sb1Provider == null)
+			return;
+		
+		List<ISDK> sdks = sb1Provider.createSDKs();
+		for (ISDK sdk : sdks) {
+			ISDKTarget[] targets = sdk.getSDKTargets();
+			// for this test, we need to have something to test
+			assertTrue(targets.length > 0);
+			for (ISDKTarget target : targets) {
+				_testSDKTarget(target);
+				_testSDKTargetFileConvs(target);
+				_testSDKTargetFileAccess(target);
+			}
+		}
+	}
+
+	private void _testSDKTarget(ISDKTarget target) {
+		System.out.println("found target: " + target);
+
+		assertNotNull(target.getSDK());
+		assertSame(target, target.getSDK().findSDKTarget(target.getName()));
+		assertNotNull(target.getName());
+		assertNotNull(target.getProcessLauncherFactory());
+		assertNotNull(target.getPlatform());
+		assertNotNull(target.getArchitecture());
+		
+	}
+
+	private void _testSDKTargetFileConvs(ISDKTarget target) {
+		// make sure root makes sense
+		assertEquals(target.getSDK().getSDKRoot(), target.getSDKRoot());
+		assertTrue(target.getSDK().getSDKRoot().isPrefixOf(target.getSDKRoot()));
+		assertTrue(target.getSDKRoot().toString(), target.getMachineFileSystemAccess().getFileStore(
+				target.getSDKRoot()).fetchInfo().exists());
+	
+
+		// test some conversions
+		IPath sbPath, hostPath;
+		
+		// all of these paths may appear at different places inside scratchbox
+		String[] tests = {
+			"/tmp",
+			"/usr",
+			"/usr/include",
+			"/usr/lib",
+			"/bin",
+			"/bin/sh",
+			"/sbin",
+			"/usr/include/fcntl.h"
+		};
+		for (String test : tests) {
+			sbPath = new Path(test);
+			hostPath = null;
+			
+			// ignore bogus target installed on my system -- no underscore in name
+			if (target.getName().contains("_")) {
+				// make sure the path can be converted to somewhere on the machine
+				// (no guarantee we can see it on the host machine)
+				IFileStore store = target.getTargetFileSystemAccess().getFileStore(sbPath);
+				assertTrue(target + " @" + sbPath.toString(), store.fetchInfo().exists());
+				
+				// if we happen to be running locally, verify sanity
+				if (target.getSDK().getMachine() instanceof ILocalMachine) {
+					try {
+						hostPath = target.convertTargetToHostPath(sbPath);
+						assertTrue(hostPath.toFile().toString(),
+								target.getTargetFileSystemAccess().getFileStore(hostPath).fetchInfo().exists());
+						// there's no guarantee of being able to convert back, but
+						// at least don't throw
+						//assertEquals(sbPath, target.convertHostToTargetPath(hostPath));
+						target.convertHostToTargetPath(hostPath);
+					} catch (MicaException e) {
+						fail(e.getMessage());
+					}
+				}
+			}			
+		}
+		
+	}
+
+	private void _testSDKTargetFileAccess(ISDKTarget target) {
+		IFileStore sbRoot = target.getTargetFileSystemAccess().getFileStore(target.getSDKRoot());
+		assertTrue(sbRoot.fetchInfo().exists());
+		
+		// these tests only make sense if running the scratchbox machine 
+		
+		// be sure we don't get an empty path here
+		IPath sbPath = null;
+		IPath hostPath;
+		try {
+			sbPath = target.convertHostToTargetPath(target.getSDKRoot());
+			assertEquals(new Path("/"), sbPath);
+			
+			// guaranteed NOT to be an SB1 path
+			hostPath = new Path("/");
+			try {
+				sbPath = target.convertHostToTargetPath(hostPath);
+				fail();
+			} catch (MicaException e) {
+			}
+			
+			IPath rootstrapPath = ((IScratchboxSDKTarget) target).getRootstrapPath();
+			if (target.getName().toLowerCase().contains("chinook40"))
+				assertNotNull(rootstrapPath);
+			if (rootstrapPath != null) {
+				System.out.println("  rootstrap path is -> " + rootstrapPath);
+				IFileStore store = target.getTargetFileSystemAccess().getFileStore(rootstrapPath);
+				assertTrue(store.fetchInfo().exists());
+				assertTrue(store.getChild("/lib").fetchInfo().exists());
+			}
+		} catch (MicaException e) {
+			// just handle it
+		}
+		
+	}
+
+
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.junit.Test;
+import org.maemo.esbox.internal.scratchbox.sb2.provider.Scratchbox2SDKProvider;
+import org.maemo.mica.common.core.*;
+import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.sdk.*;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * If SB2 is installed, make sure its SDKs and targets are properly detected,
+ * and that it launches processes in the expected way
+ * 
+ * @author eswartz
+ * 
+ */
+public class TestSB2ProcessLauncher extends TestProcessLauncher {
+	ISDKProvider sb2Provider;
+	private static List<ISDK> sdks;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		IPreferenceStore preferenceStore = CorePreferenceManager.getInstance().getPreferenceStore(
+				CorePreferenceConstants.LOG_COMMANDS);
+		preferenceStore.setValue(
+						CorePreferenceConstants.LOG_COMMANDS, true);
+		
+		SDKFactory factory = SDKFactory.getInstance();
+
+		List<ISDKProvider> providers = factory.getSDKProviders();
+		assertNotNull(providers);
+
+		// don't worry if we don't find an SB2 installation
+		// on this host (this is mostly a manual test)
+		for (ISDKProvider provider : providers) {
+			if (provider instanceof Scratchbox2SDKProvider) {
+				sb2Provider = provider;
+				break;
+			}
+		}
+
+		if (sb2Provider == null && !Platform.isRunning()) {
+			// in case of standalone test
+			sb2Provider = new Scratchbox2SDKProvider();
+		}
+
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected List<ISDK> getSDKs() throws MicaException {
+		if (sdks == null) {
+			if (sb2Provider == null)
+				sdks = Collections.EMPTY_LIST;
+			else
+				sdks = sb2Provider.createSDKs();
+		}
+		return sdks;
+	}
+
+	/** Make sure commands are assembled appropriately */
+	@Test
+	public void testSB2ProcessLauncherAssembly() throws Exception {
+		runOverTargets(new IRunner() {
+
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "ls");
+				List<String> args = processLauncher.getLaunchCommandArguments();
+				assertNotNull(args);
+
+				// be sure no variables are left unexpanded
+				assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+				// assume the pattern is still sb2 -e -t ...
+				assertEquals("sb2", args.get(0));
+				assertTrue(args.contains("-t"));
+				assertTrue(args.contains("-e") || args.contains("-m"));
+			}
+		});
+	}
+
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * 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.scratchbox.tests;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.internal.scratchbox.sb2.provider.Scratchbox2SDKProvider;
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.ILocalMachine;
+import org.maemo.mica.common.core.sdk.*;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * If SB2 is installed, make sure its SDKs and targets
+ * are properly detected, and that it launches processes
+ * in the expected way
+ * @author eswartz
+ *
+ */
+public class TestSB2SDKProvider extends TestCase {
+	private ISDKProvider sb2Provider;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		SDKFactory factory = SDKFactory.getInstance();
+
+		List<ISDKProvider> providers = factory.getSDKProviders();
+		assertNotNull(providers);
+		
+		// don't worry if we don't find an SB1 installation
+		// on this host (this is mostly a manual test)
+		for (ISDKProvider provider : providers) {
+			if (provider instanceof Scratchbox2SDKProvider) {
+				sb2Provider = provider;
+				break;
+			}
+		}
+		
+		if (sb2Provider == null && !Platform.isRunning()) {
+			// in case of standalone test
+			sb2Provider = new Scratchbox2SDKProvider();
+		}
+
+	}
+	
+	@Test
+	public void testSB2SDKProvider() throws Exception {
+		if (sb2Provider == null)
+			return;
+		
+		List<ISDK> sdks = sb2Provider.createSDKs();
+		assertNotNull(sdks);
+		
+		for (ISDK sdk : sdks) {
+			// the name mentions the scratchbox name and version
+			assertEquals("Scratchbox 2", sdk.getName());
+			assertTrue(sdk.getVersion().matches("1\\.99\\..*"));
+			IPath root = sdk.getSDKRoot();
+			assertTrue(sdk.getMachineFileSystemAccess().getFileStore(root).fetchInfo().exists());
+			assertTrue(root.toPortableString().equals("/"));
+		}
+	}
+	
+	@Test
+	public void testSB2SDKTargets() throws Exception {
+		if (sb2Provider == null)
+			return;
+		
+		List<ISDK> sdks = sb2Provider.createSDKs();
+		for (ISDK sdk : sdks) {
+			ISDKTarget[] targets = sdk.getSDKTargets();
+			for (ISDKTarget target : targets) {
+				if (target.getName().contains("DELETEME") || target.getName().contains("bora"))
+					continue;
+				_testSDKTarget(target);
+			}
+		}
+	}
+
+	private void _testSDKTarget(ISDKTarget target) {
+		System.out.println("found sb2 target: " + target);
+
+		assertNotNull(target.getSDK());
+		assertSame(target, target.getSDK().findSDKTarget(target.getName()));
+		assertNotNull(target.getName());
+		assertNotNull(target.getProcessLauncherFactory());
+		assertNotNull(target.getPlatform());
+		assertNotNull(target.getArchitecture());
+
+		// make sure root makes sense
+		assertEquals("target sdk->root", target.getSDK().getSDKRoot(), target.getSDKRoot());
+		assertTrue(target + " root ", target.getSDK().getSDKRoot().isPrefixOf(target.getSDKRoot()));
+		assertTrue(target + " filesystem root", target.getTargetFileSystemAccess().getFileStore(target.getSDKRoot()).fetchInfo().exists());
+	
+
+		// test some conversions
+		IPath sbPath = new Path("/usr/include");
+		IFileStore hostFile = null;
+		hostFile = target.getTargetFileSystemAccess().getFileStore(sbPath);
+		assertTrue(target + ": "+ hostFile.toString(), hostFile.fetchInfo().exists());
+		
+		// be sure we don't get an empty path here
+		IFileStore sbRoot = null;
+		sbRoot = target.getSDK().getMachineFileSystemAccess().getFileStore(target.getSDKRoot());
+		assertTrue(sbRoot.fetchInfo().exists());
+		
+		// these tests only work on machine
+		IPath hostPath = new Path("/");
+		if (target.getSDK().getMachine() instanceof ILocalMachine) {
+			try {
+				sbPath = target.convertHostToTargetPath(hostPath);
+			} catch (MicaException e) {
+				fail(e.toString());
+			}
+			assertEquals(hostPath, sbPath);
+		}
+		
+		// make sure we can find the non-host version
+		IPath libPath = new Path("/lib");
+		hostPath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(libPath);
+		if (hostPath.equals(libPath))
+			failNotEquals("expected unique sb2 path from " + target, hostPath, libPath);
+
+		// verify new parser
+		IPath etcPath = new Path("/etc");
+		hostPath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(etcPath);
+		assertNotNull(hostPath);
+		assertTrue(hostPath.toString(),
+				new Path("/opt/maemo/dists/etch/etc").equals(hostPath)
+				|| etcPath.equals(hostPath));
+		
+		IPath rootstrapPath = ((IScratchboxSDKTarget) target).getRootstrapPath();
+		if (target.getName().contains("chinook40"))
+			assertNotNull(rootstrapPath);
+		if (rootstrapPath != null) {
+			System.out.println(target + " root is -> " + rootstrapPath);
+			IFileStore store = target.getTargetFileSystemAccess().getFileStore(rootstrapPath);
+			assertTrue(store.fetchInfo().exists());
+			assertTrue(store.getChild("lib").fetchInfo().exists());
+		}
+
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/AllTests.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/AllTests.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/AllTests.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for org.maemo.esbox.scratchbox.tests.commands");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(TestRootstrapCommand.class);
+		suite.addTestSuite(TestGdbQemuCommand.class);
+		suite.addTestSuite(TestSelectTargetCommand.class);
+		suite.addTestSuite(TestShowTargetCommand.class);
+		suite.addTestSuite(TestRemoveCommand.class);
+		suite.addTestSuite(TestScratchbox2SDK.class);
+		suite.addTestSuite(TestShowPathMappingSb2Command.class);
+		suite.addTestSuite(TestResetTargetCommand.class);
+		suite.addTestSuite(TestScratchboxCommand.class);
+		suite.addTestSuite(TestListCommands.class);
+		suite.addTestSuite(TestRemoveSb2Command.class);
+		suite.addTestSuite(TestSimpleCommand.class);
+		suite.addTestSuite(TestCreateTargetCommand.class);
+		suite.addTestSuite(TestGetCurrentTargetCommand.class);
+		suite.addTestSuite(TestScratchboxFacade.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseSb2Test.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseSb2Test.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseSb2Test.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,23 @@
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoRootstrapCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoSdkCommand;
+
+public class BaseSb2Test extends BaseTest {
+	protected MaemoSdkCommand maemoSdkCommand;
+	protected MaemoRootstrapCommand maemoRootstrapCommand;
+	
+	@Override
+	public void setUp() throws Exception {
+		super.setUp();
+		if(sb2Sdk!=null){
+			maemoSdkCommand = new MaemoSdkCommand(sb2Command,
+					sb2Sdk.getMachineProcessLauncherFactory());
+			maemoRootstrapCommand = new MaemoRootstrapCommand(sb2Command,
+					sb2Sdk.getMachineProcessLauncherFactory());
+		}else{
+			fail("Scratchbox2 is not supported in current environment.");
+		}
+		
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseTest.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseTest.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/BaseTest.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import org.junit.Before;
+import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoRootstrapCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoSdkCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDK;
+import org.maemo.mica.common.core.machine.IFileSystemAccess;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
+
+import junit.framework.TestCase;
+
+/**
+ * Base test for the ICommand tests
+ * @author eswartz
+ *
+ */
+public abstract class BaseTest extends TestCase {
+
+	protected IScratchbox1SDK sb1Sdk;
+	protected ICommandAbstractor sb1Command;
+	protected IScratchbox2SDK sb2Sdk;
+	protected ICommandAbstractor sb2Command;
+	protected ICommandAbstractor sb2ArmelTargetCommand;
+	/**
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		this.sb1Sdk = ScratchboxSDKFacade.getInstance().getScratchboxSDK(IScratchbox1SDK.class).get(0);
+		this.sb1Command = ((Scratchbox1SDK) sb1Sdk).getCommandAbstractor();  
+		this.sb2Sdk = ScratchboxSDKFacade.getInstance().getScratchboxSDK(IScratchbox2SDK.class).get(0);
+		this.sb2Command = ((Scratchbox2SDK) sb2Sdk).getCommandAbstractor();
+		if (sb2Sdk != null) {
+			for (ISDKTarget target : sb2Sdk.getSDKTargets()) {
+				if (target.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL) && 
+						!target.getName().contains("minimal") &&
+						!target.getName().contains("REMOVEME")) {
+					final ISDKTarget sdkTarget = target;
+					this.sb2ArmelTargetCommand =  new ICommandAbstractor() {
+
+						public String getPreferenceValue(String key) {
+							return sdkTarget.getPreferenceValue(key);
+						}
+
+						public IProcessLauncherFactory getProcessLauncherFactory() {
+							return sdkTarget.getProcessLauncherFactory();
+						}
+
+						public IFileSystemAccess getFileSystemAccess() {
+							return sdkTarget.getTargetFileSystemAccess();
+						}
+					};
+					break;
+				}
+			}
+		}
+	}
+	
+	/**
+	 * Get a command abstractor that will not actually execute code.
+	 * @param target if non-null, use an SB2 mock process launcher, else use a host mock process launcher
+	 * @return ICommandAbstractor
+	 */
+	protected MockCommandAbstractor getSb2MockCommandAbstractor(final ISDKTarget target) {
+		return new MockCommandAbstractor(sb2Command, target);
+
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockCommandAbstractor.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockCommandAbstractor.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockCommandAbstractor.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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.scratchbox.tests.commands;
+
+import org.maemo.mica.common.core.machine.IFileSystemAccess;
+import org.maemo.mica.common.core.process.HostProcessLauncherFactory;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
+
+import java.util.List;
+
+public class MockCommandAbstractor implements ICommandAbstractor {
+	private final ISDKTarget target;
+	private final ICommandAbstractor wrapped;
+	private MockProcessLauncherFactory lastLauncherFactory;
+
+	public MockCommandAbstractor(ICommandAbstractor wrapped, ISDKTarget target) {
+		this.wrapped = wrapped;
+		this.target = target;
+	}
+
+	public String getPreferenceValue(String key) {
+		return wrapped.getPreferenceValue(key);
+	}
+
+	public IProcessLauncherFactory getProcessLauncherFactory() {
+		if (target != null)
+			lastLauncherFactory = new MockProcessLauncherFactory(
+					target.getProcessLauncherFactory());
+					//new Scratchbox2ProcessLauncherFactory(
+					//target, SB2PreferenceConstants.SB2_MAPPING_MODE, false));
+		else
+			lastLauncherFactory = new MockProcessLauncherFactory(new HostProcessLauncherFactory());
+		return lastLauncherFactory;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.internal.common.core.command.ICommandAbstractor#getFileSystemAccess()
+	 */
+	public IFileSystemAccess getFileSystemAccess() {
+		return target.getTargetFileSystemAccess();
+	}
+
+	public List<String> getLastCommandLine() {
+		return lastLauncherFactory.getLastCommandLine();
+	}
+}
\ No newline at end of file

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncher.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncher.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.IStreamLineMonitor;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * This process launcher does not actually launch anything but allows
+ * access to the generated arguments and environment.
+ * @author eswartz
+ *
+ */
+public class MockProcessLauncher implements IProcessLauncher {
+
+	private final IProcessLauncher wrapped;
+	private Process theProcess;
+
+	public MockProcessLauncher(IProcessLauncher launcher) {
+		this.wrapped = launcher;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#createProcess()
+	 */
+	public Process createProcess() throws MicaException {
+		theProcess = new Process() {
+
+			@Override
+			public void destroy() {
+				// TODO Auto-generated method stub
+				
+			}
+
+			@Override
+			public int exitValue() {
+				// TODO Auto-generated method stub
+				return 0;
+			}
+
+			@Override
+			public InputStream getErrorStream() {
+				// TODO Auto-generated method stub
+				return null;
+			}
+
+			@Override
+			public InputStream getInputStream() {
+				// TODO Auto-generated method stub
+				return null;
+			}
+
+			@Override
+			public OutputStream getOutputStream() {
+				// TODO Auto-generated method stub
+				return null;
+			}
+
+			@Override
+			public int waitFor() throws InterruptedException {
+				// TODO Auto-generated method stub
+				return 0;
+			}
+			
+		};
+		return theProcess;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.process.IProcessLauncher#getLastCreatedProcess()
+	 */
+	public Process getLastCreatedProcess() {
+		return theProcess;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#getLaunchCommandArguments()
+	 */
+	public List<String> getLaunchCommandArguments() {
+		return wrapped.getLaunchCommandArguments();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#getLaunchEnvironment()
+	 */
+	public IEnvironmentModifierBlock getLaunchEnvironmentModifierBlock() {
+		return wrapped.getLaunchEnvironmentModifierBlock();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#getLaunchCurrentWorkingDirectory()
+	 */
+	public IPath getLaunchCurrentWorkingDirectory() {
+		return wrapped.getLaunchCurrentWorkingDirectory();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#isUsePTY()
+	 */
+	public boolean isUsePTY() {
+		return wrapped.isUsePTY();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#usePTY(boolean)
+	 */
+	public void usePTY(boolean flag) {
+		wrapped.usePTY(flag);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#redirectToConsole(org.eclipse.ui.console.MessageConsole, org.maemo.esbox.common.core.sdk.ISDKTarget)
+	 */
+	public MessageConsole redirectToConsole(MessageConsole console) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#redirectToConsole(org.eclipse.ui.console.MessageConsole, org.maemo.esbox.common.core.sdk.ISDKTarget, org.maemo.esbox.common.core.IStreamLineMonitor)
+	 */
+	public MessageConsole redirectToConsole(MessageConsole console,
+			IStreamLineMonitor monitor) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#redirectToConsole(boolean, org.maemo.esbox.common.core.sdk.ISDKTarget, java.lang.String)
+	 */
+	public MessageConsole redirectToConsole(boolean brandNew,
+			ISDKTarget sdkTarget, String consoleName) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#redirectToConsole(boolean, org.maemo.esbox.common.core.sdk.ISDKTarget, java.lang.String, org.maemo.esbox.common.core.IStreamLineMonitor)
+	 */
+	public MessageConsole redirectToConsole(boolean brandNew,
+			ISDKTarget sdkTarget, String consoleName, IStreamLineMonitor monitor) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream)
+	 */
+	public int waitAndRead(OutputStream out, OutputStream err) {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, boolean)
+	 */
+	public int waitAndRead(OutputStream out, OutputStream err,
+			boolean showCommand) {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public int waitAndRead(OutputStream output, OutputStream err,
+			IProgressMonitor monitor) {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor, boolean)
+	 */
+	public int waitAndRead(OutputStream output, OutputStream err,
+			IProgressMonitor monitor, boolean showCommand) {
+		return 0;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncherFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncherFactory.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/MockProcessLauncherFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+
+/**
+ * This factory creates process launchers that do not actually execute anything 
+ * but allow for testing the generated command line through the process launcher.
+ * @author eswartz
+ *
+ */
+public class MockProcessLauncherFactory implements IProcessLauncherFactory {
+
+	private IProcessLauncherFactory wrapped;
+	private IProcessLauncher lastProcessLauncher;
+
+	public MockProcessLauncherFactory(IProcessLauncherFactory wrapped) {
+		this.wrapped = wrapped;
+	}
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.IProcessLauncherFactory#createProcessLauncher(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+	 */
+	public IProcessLauncher createProcessLauncher(IPath workingDirectory,
+			List<String> commandLine, IEnvironmentModifierBlock environment) {
+		lastProcessLauncher = wrapped.createProcessLauncher(workingDirectory, commandLine, environment);
+		return new MockProcessLauncher(lastProcessLauncher);
+	}
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.process.IProcessLauncherFactory#getDefaultEnvironmentModifierBlock()
+	 */
+	public IEnvironmentModifierBlock defaultEnvironmentModifierBlock() {
+		return wrapped.defaultEnvironmentModifierBlock();
+	}
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.common.core.process.IProcessLauncherFactory#getRawEnvironment()
+	 */
+	public Properties getRawEnvironment() {
+		return wrapped.getRawEnvironment();
+	}
+
+	public List<String> getLastCommandLine() {
+		return lastProcessLauncher.getLaunchCommandArguments();
+	}
+	
+
+	
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestCreateTargetCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestCreateTargetCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestCreateTargetCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb1.command.*;
+import org.maemo.esbox.internal.scratchbox.sb1.core.SB1PreferenceConstants;
+import org.maemo.esbox.scratchbox.core.command.ScratchboxCommand;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestCreateTargetCommand extends BaseTest {
+
+
+	private class CreateTargetCommandMock extends CreateTargetCommand {
+	
+		public CreateTargetCommandMock(IScratchbox1SDK sdk, ICommandAbstractor commandLauncher) {
+			super(sdk, commandLauncher);
+		}
+
+		@Override
+		protected String[] replaceActions(String targetName, String compiler,
+				String devkits, String cputransp) {
+			// TODO Auto-generated method stub
+			return super.replaceActions(targetName, compiler, devkits,
+					cputransp);
+		}
+	
+	}
+
+	private final String TARGET_NAME = "TEST_TARGET";
+	
+	public void testPerformCommand() throws MicaException {
+		ScratchboxCommand createTargetCommand = new CreateTargetCommand(sb1Sdk, sb1Command);
+
+		List<String> param = new ArrayList<String>();
+
+		param.add(TARGET_NAME);
+		param.add("cs2005q3.2-glibc2.5-arm");
+		param.add("doctools:cputransp");
+		try {
+			createTargetCommand.performCommand(param);
+			fail("Number of args is invalid");
+		} catch (MicaException e) {
+			// expected
+		}
+		param.add("qemu-arm-0.8.2-sb2");
+		createTargetCommand.performCommand(param);
+
+		List<String> targetsAvailable = new ListTargetsCommand(sb1Command)
+				.performCommand(new ArrayList<String>());
+		assertTrue(targetsAvailable.contains(TARGET_NAME));
+
+		// remove the target created for the test
+		removeTestTarget();
+		targetsAvailable = new ListTargetsCommand(sb1Command)
+				.performCommand(new ArrayList<String>());
+		assertTrue(!targetsAvailable.contains(TARGET_NAME));
+
+		param.clear();
+		param.add(TARGET_NAME);
+		param.add("");
+		param.add("debian:doctools:cputransp");
+		param.add("qemu-arm-0.8.2-sb2");
+		try {
+			createTargetCommand.performCommand(param);
+			fail("Cannot create a TARGET without a compiler.");
+		} catch (MicaException se) {
+			// expected
+		}
+		targetsAvailable = new ListTargetsCommand(sb1Command)
+				.performCommand(new ArrayList<String>());
+		assertTrue(!targetsAvailable.contains(TARGET_NAME));
+	}
+
+	private void removeTestTarget() throws MicaException {
+		ScratchboxCommand removeCommand = new RemoveTargetCommand(sb1Sdk, sb1Command);
+		List<String> removeParam = new ArrayList<String>();
+		removeParam.add(TARGET_NAME);
+		removeCommand.performCommand(removeParam);
+	}
+
+	public void testReplaceActions() {
+		final String stringToCompareA = "sb-conf setup "
+				+ TARGET_NAME
+				+ " --compiler=a_compiler --devkits=devkit_a:devkit_b --cputransp=a_cputransp_method";
+		final String[] stringArrayToCompareA = new String[] { TARGET_NAME,
+				"--compiler=a_compiler", "--devkits=devkit_a:devkit_b",
+				"--cputransp=a_cputransp_method" };
+
+		CreateTargetCommandMock createCommand = new CreateTargetCommandMock(sb1Sdk, sb1Command);
+		String[] setupActionOptionsReplaced = createCommand.replaceActions(
+				TARGET_NAME, "a_compiler", "devkit_a:devkit_b",
+				"a_cputransp_method");
+
+		for (int i = 0; i < setupActionOptionsReplaced.length; i++) {
+			assertEquals(stringArrayToCompareA[i],
+					setupActionOptionsReplaced[i]);
+		}
+
+		String setupAction = sb1Sdk.getPreferenceValue(SB1PreferenceConstants.SB1_SETUP_ACT);
+
+		String stringSetup = createCommand.replaceScratchboxConfigCommand(
+				setupAction, setupActionOptionsReplaced);
+		assertEquals(stringToCompareA, stringSetup);
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGdbQemuCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGdbQemuCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGdbQemuCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.mica.common.core.MicaException;
+
+
+/**
+ * @author eswartz
+ */
+public class TestGdbQemuCommand extends BaseTest {
+
+	public void testQemuVersionCommand() throws MicaException {
+		for (IScratchboxSDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+			String pattern = sdkTarget.getGdbQemuCommandPattern(
+					sdkTarget.getArchitecture());
+			assertNotNull(pattern);
+			if (sdkTarget.getSboxVersion() == 2) {
+				assertTrue(pattern.contains("${PORT}"));
+			} 
+			if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+				assertTrue(pattern.contains("qemu-arm"));
+				if (pattern.contains("qemu-arm-0.7"))
+					assertFalse(pattern.contains("${PORT}"));
+				else if (pattern.contains("qemu-arm-0.8"))
+					assertTrue(pattern.contains("${PORT}"));
+			}
+			System.out.println("pattern of gdb-qemu for " + sdkTarget + " is " + pattern);
+		}
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGetCurrentTargetCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGetCurrentTargetCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestGetCurrentTargetCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.api.scratchbox.core.commands.ScratchboxInvalidOperationException;
+import org.maemo.esbox.internal.scratchbox.sb1.command.GetCurrentTargetCommand;
+import org.maemo.mica.common.core.MicaException;
+
+import java.util.ArrayList;
+
+/**
+ *  Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestGetCurrentTargetCommand extends BaseTest {
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.GetCurrentTargetCommand#performCommand(java.lang.Object)}.
+	 * 
+	 * @throws ScratchboxInvalidOperationException
+	 */
+	public void testPerformCommand() throws MicaException {
+		GetCurrentTargetCommand getCurrentTargetCommand = new GetCurrentTargetCommand(sb1Command, sb1Sdk);
+		String currentTarget = getCurrentTargetCommand
+				.performCommand(new ArrayList<String>());
+		assertTrue(currentTarget.length() > 0);
+		assertNotNull(sb1Sdk.findSDKTarget(currentTarget));
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,313 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb1.command.*;
+import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.ProcessLauncherCreator;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+import java.util.*;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestListCommands extends BaseTest {
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ListCompilersCommand#performCommand(java.util.List)}.
+	 */
+	public void testListCompilersCommand() throws MicaException {
+		List<String> fakeParam = new ArrayList<String>();
+		fakeParam.add("param");
+
+		List<String> compilersExpected = new ArrayList<String>();
+		compilersExpected.add("host-gcc");
+		compilersExpected.add("cs2005q3.2-glibc2.5-arm");
+		compilersExpected.add("cs2005q3.2-glibc2.5-i386");
+		compilersExpected.add("cs2007q3-glibc2.5-arm");
+		compilersExpected.add("cs2007q3-glibc2.5-i386");
+
+		ListCompilersCommand listCompilersCommand = new ListCompilersCommand(sb1Command);
+		List<String> compilers = null;
+		try {
+			listCompilersCommand.performCommand(fakeParam);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// expected
+		}
+		compilers = listCompilersCommand
+				.performCommand(new ArrayList<String>());
+
+		// just make sure there is more than one devkit and that one of them looks like
+		// something we recognize
+		boolean matched = false;
+		for (String compiler : compilers) {
+			assertTrue(compiler.length() > 0);
+			if (compilersExpected.contains(compiler))
+				matched = true;
+		}
+		assertTrue(matched);
+
+		/*
+		for (int i = 0; i < compilersExpected.size(); i++) {
+			assertTrue(compilers.contains(compilersExpected.get(i)));
+		}
+		*/
+
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ListCputranspCommand#performCommand(java.util.List)}.
+	 */
+	public void testListCputranspCommand() throws MicaException {
+		List<String> fakeParam = new ArrayList<String>();
+		fakeParam.add("param");
+
+		List<String> cputranspExpected = new ArrayList<String>();
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-m2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.0-m2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.2-sb2");
+		cputranspExpected.add("/scratchbox/devkits/cputransp/bin/sbrsh");
+
+		ListCputranspCommand listCputranspCommand = new ListCputranspCommand(sb1Command);
+		List<String> cputransps = null;
+
+		try {
+			listCputranspCommand.performCommand(fakeParam);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// expected
+		}
+
+		cputransps = listCputranspCommand
+				.performCommand(new ArrayList<String>());
+
+		// just make sure there is more than one devkit and that one of them looks like
+		// something we recognize
+		boolean matched = false;
+		for (String cputransp : cputransps) {
+			assertTrue(cputransp.length() > 0);
+			if (cputranspExpected.contains(cputransp))
+				matched = true;
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < cputranspExpected.size() && i < cputransp.size(); i++) {
+			assertTrue(cputransp.contains(cputranspExpected.get(i)));
+		}
+		*/
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ListDevkitsCommand#performCommand(java.util.List)}.
+	 */
+	public void testListDevkitsCommand() throws MicaException {
+		List<String> fakeParam = new ArrayList<String>();
+		fakeParam.add("param");
+
+		List<String> devkitsExpected = new ArrayList<String>();
+		devkitsExpected.add("cputransp");
+		devkitsExpected.add("debian");
+		devkitsExpected.add("debian-sarge");
+		devkitsExpected.add("doctools");
+		devkitsExpected.add("perl");
+
+		ListDevkitsCommand listDevkitsCommand = new ListDevkitsCommand(sb1Command);
+		List<String> devkits = null;
+
+		try {
+			listDevkitsCommand.performCommand(fakeParam);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// expected
+		}
+
+		devkits = listDevkitsCommand.performCommand(new ArrayList<String>());
+
+		// just make sure there is more than one devkit and that one of them looks like
+		// something we recognize
+		assertTrue(devkits.size() > 1);
+		boolean matched = false;
+		for (String devkit : devkits) {
+			assertTrue(devkit.length() > 0);
+			if (devkitsExpected.contains(devkit)) {
+				matched = true;
+			}
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < devkitsExpected.size() && i < devkits.size(); i++) {
+			assertTrue(devkits.contains(devkitsExpected.get(i)));
+		}
+		*/
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ListSessionsCommand#performCommand(java.util.List)}.
+	 */
+	public void testListSessionsCommand() throws Exception {
+		if (HostUtils.isWindows()) {
+			System.out.println("PTY support doesn't work, skipping test");
+			return;
+		}
+			
+		List<String> fakeParam = new ArrayList<String>();
+		fakeParam.add("param");
+
+		int numberOfSessions = 0;
+
+		ListSessionsCommand listSessionsCommand = new ListSessionsCommand(sb1Command);
+		List<String> sessions = null;
+
+		try {
+			listSessionsCommand.performCommand(fakeParam);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// expected
+		}
+
+		sessions = listSessionsCommand.performCommand(new ArrayList<String>());
+
+		// make sure anything here is a pid
+		for (String pid : sessions) {
+			Integer.parseInt(pid);
+		}
+
+		numberOfSessions = sessions.size();
+		
+		// launch a new session (without switching targets!)
+//		ISDKTarget target = ScratchboxFacade.getInstance().getCurrentSDKTarget(ScratchboxSDKFacade.getInstance().getScratchbox1SDK());
+		ISDKTarget target = ScratchboxSDKFacade.getInstance().getScratchboxSDK(Scratchbox1SDK.class).get(0).getCurrentSDKTarget();
+		
+		Process process = null;
+		try {
+			// need a PTY or else the shell fails to launch
+			IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(target.getProcessLauncherFactory(), null,
+					Collections.singletonList("/bin/sh"), null);
+			launcher.usePTY(true);
+			process = launcher.createProcess();
+			
+			// wait for it to really start
+			Thread.sleep(1000);
+		
+			sessions = listSessionsCommand.performCommand(new ArrayList<String>());
+			
+			// this either launches 1 or 2 processes
+			assertTrue(numberOfSessions < sessions.size());
+	
+			// make sure anything here is a pid
+			for (String pid : sessions) {
+				Integer.parseInt(pid);
+			}
+		} finally {		
+			// kill the shell (exit, then send ctrl-d)
+			process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
+			process.destroy();
+		}
+		
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ListTargetsCommand#performCommand(java.util.List)}.
+	 */
+	public void testListTargetsCommand() throws MicaException {
+		List<String> fakeParam = new ArrayList<String>();
+		fakeParam.add("param");
+
+		List<String> targetsExpected = new ArrayList<String>();
+		targetsExpected.add("SDK_ARMEL");
+		targetsExpected.add("SDK_X86");
+		targetsExpected.add("BORA_ARMEL");
+		targetsExpected.add("BORA_X86");
+		targetsExpected.add("CHINOOK_ARMEL");
+		targetsExpected.add("CHINOOK_X86");
+		targetsExpected.add("DIABLO_ARMEL");
+
+		ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb1Command);
+		List<String> targets = null;
+
+		try {
+			listTargetsCommand.performCommand(fakeParam);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// expected
+		}
+
+		targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+		// just make sure there is more than one target and that one of them looks like
+		// something we recognize
+		assertTrue(targets.size() > 1);
+		boolean matched = false;
+		for (String target : targets) {
+			assertTrue(target.length() > 0);
+			if (targetsExpected.contains(target)) {
+				matched = true;
+			}
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < targetsExpected.size() && i < targets.size(); i++) {
+			assertTrue(targets.contains(targetsExpected.get(i)));
+		}
+		*/
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.api.scratchbox.core.commands.ScratchboxInvalidOperationException;
+import org.maemo.esbox.internal.scratchbox.sb1.command.RemoveTargetCommand;
+import org.maemo.esbox.scratchbox.core.command.ScratchboxCommand;
+import org.maemo.mica.common.core.MicaException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestRemoveCommand extends BaseTest {
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.RemoveTargetCommand#performCommand(java.util.List)}.
+	 * 
+	 * @throws MicaException
+	 * @throws ScratchboxInvalidOperationException
+	 */
+	public void testPerformCommand() throws MicaException {
+		final String TARGET_DOESNT_EXIST = "GHOST";
+		ScratchboxCommand removeCommand = new RemoveTargetCommand(sb1Sdk, sb1Command);
+
+		List<String> param = new ArrayList<String>();
+
+		try {
+			removeCommand.performCommand(param);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// TODO: handle exception
+		}
+
+		param.add(TARGET_DOESNT_EXIST);
+
+		try {
+			removeCommand.performCommand(param);
+			fail("The target " + TARGET_DOESNT_EXIST
+					+ " does not exist. An error must be throwed.");
+		} catch (MicaException e) {
+			// the test is OK, so far.
+		}
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.scratchbox.tests.commands;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.internal.api.scratchbox.core.sdk.CacheUtils;
+import org.maemo.mica.common.core.MicaException;
+
+/**
+ */
+public class TestRemoveSb2Command extends BaseSb2Test {
+
+	public void testPerformCommand() throws MicaException {
+		final String TARGET_DOESNT_EXIST = "GHOST";
+		
+		List<String> param = new ArrayList<String>();
+
+		try {
+			maemoRootstrapCommand.remove(TARGET_DOESNT_EXIST);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// TODO: handle exception
+		}
+
+		param.add(TARGET_DOESNT_EXIST);
+
+		try {
+			maemoRootstrapCommand.showLocation(TARGET_DOESNT_EXIST);
+			fail("The target " + TARGET_DOESNT_EXIST
+					+ " does not exist. An error must be throwed.");
+		} catch (MicaException e) {
+			// the test is OK, so far.
+		}
+	}
+	
+	public void testRemoveRealTarget() throws Exception {
+		final String TARGET = "REMOVEME_armel";
+		
+		try {
+			sb2Sdk.createTarget(TARGET,sb2Sdk.getCompilers().get(0), null,null);
+		} catch (MicaException e) {
+			// don't worry if it fails, as it might, since installing a 
+			// bogus target in sb2 often fails to initialize properly
+		}
+		
+		List<String> targets = new ArrayList<String>();
+		try {
+			targets = sb2Sdk.getTargets();
+		} catch (MicaException e) {
+			// again, ignore error
+		}
+		
+		if (targets.contains(TARGET)) {
+			List<String> param = Collections.singletonList(TARGET);
+			try {
+				CacheUtils.getInstance().clearCachedData();
+				maemoRootstrapCommand.remove(TARGET);
+				
+				CacheUtils.getInstance().clearCachedData();
+				targets = sb2Sdk.getTargets();
+				assertFalse(targets.contains(TARGET));
+			} catch (MicaException e) {
+				throw e;
+			}			
+		}
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestResetTargetCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestResetTargetCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestResetTargetCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT
+ * 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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestResetTargetCommand extends BaseTest {
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ResetTargetCommand#performCommand(java.util.List)}.
+	 */
+	public void testPerformCommand() {
+
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRootstrapCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRootstrapCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRootstrapCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestRootstrapCommand extends BaseTest {
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.RootstrapCommand#performCommand(java.util.List)}.
+	 */
+	public void testPerformCommand() {
+
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.maemo.esbox.internal.api.scratchbox.core.sdk.IScratchboxSDKPlatformArchitectureProvider;
+import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
+import org.maemo.mica.common.core.sdk.ISDKPlatform;
+
+public class TestScratchbox2SDK extends BaseSb2Test {
+	Set<String> possibleRootstraps = null;
+	
+	@Override
+	public void setUp() throws Exception {
+		super.setUp();
+		possibleRootstraps = new HashSet<String>();
+		possibleRootstraps.add("diablo41_armel");
+		possibleRootstraps.add("diablo41_i386");
+		possibleRootstraps.add("chinook40_armel");
+		possibleRootstraps.add("bora31_armel");
+		possibleRootstraps.add("scirocco22_armel");
+		possibleRootstraps.add("mistral20_armel");
+	}
+	@Override
+	protected void tearDown() throws Exception {
+		possibleRootstraps = null;
+		super.tearDown();
+	}
+	
+	public void testInstalledMaemoRootstraps() throws Exception {
+		List<String> rootstraps =sb2Sdk.getInstalledMaemoRootstraps();
+		assertFalse("No rootstraps instaleld", rootstraps.isEmpty());
+		for(String rootstrap : rootstraps)
+			assertTrue(rootstrap+" is not in possible rootstraps set", possibleRootstraps.contains(rootstrap));
+		
+	}
+	
+	public void testAvailableMaemoRootstraps() throws Exception {
+		List<String> rootstraps = sb2Sdk.getAvailableMaemoRootstraps();
+		assertTrue("Available rootstrap list is not same as predefined possible rootstraps list.",
+				rootstraps.containsAll(possibleRootstraps) && rootstraps.size()==possibleRootstraps.size());
+		
+	}
+	
+	public void testGetArchitecture() throws Exception {
+		IScratchboxSDKPlatformArchitectureProvider 
+			provider = (IScratchboxSDKPlatformArchitectureProvider)sb2Sdk;
+		assertEquals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL,provider.getArchitecture("diablo41_armel"));
+		assertEquals(IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN,provider.getArchitecture("WRONG_TARGET"));
+	}
+	
+	public void testGetPlatform() throws Exception {
+		ISDKPlatform platform = sb2Sdk.getPlatform("diablo41_armel");
+		assertEquals("Diablo", platform.getName());
+		assertEquals("4.1", platform.getVersion());
+		
+		platform = sb2Sdk.getPlatform("diablo41_x86");
+		assertEquals("Diablo", platform.getName());
+		assertEquals("4.1", platform.getVersion());
+		
+		platform = sb2Sdk.getPlatform("diablo41_i386");
+		assertEquals("Diablo", platform.getName());
+		assertEquals("4.1", platform.getVersion());
+	}
+	
+	
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb1.command.AbstractSB1Command;
+import org.maemo.esbox.internal.scratchbox.sb1.core.SB1PreferenceConstants;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
+
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestScratchboxCommand extends BaseTest {
+
+	/**
+	 * Mock class to test ScratchboxCommand abstract class.
+	 * 
+	 * @author Raul Fernandes Herbster - raulherbster at gmail dot com
+	 */
+	class MockScratchboxCommand extends AbstractSB1Command {
+
+		
+		public MockScratchboxCommand(ICommandAbstractor commandAbstractor) {
+			super(commandAbstractor);
+		}
+
+		public Object performCommand(List<String> param)
+				throws MicaException {
+			return null;
+		}
+
+		@Override
+		public int getParametersSize() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		
+		
+
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ScratchboxCommand#replaceScratchboxCommand(java.lang.String, java.lang.String, java.lang.String[])}.
+	 */
+	public void testReplaceScratchboxCommandStringStringStringArray() {
+		final String stringToCompareA = "sb-conf current";
+		String currentTargetAction = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_CURRENT_ACT);
+		AbstractSB1Command scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+
+		String stringGetCurrent = scratchboxCommandA
+				.replaceScratchboxConfigCommand(currentTargetAction);
+		assertEquals(stringToCompareA, stringGetCurrent.trim());
+
+	}
+
+	/**
+	 * Test method for
+	 * {@link embedded.core.scratchbox.command.ScratchboxCommand#replaceScratchboxConfigCommand(java.lang.String, java.lang.String)}.
+	 */
+	public void testReplaceScratchboxCommandStringString() {
+		final String stringToCompareA = "sb-conf show --compilers --devkits --cputransp";
+
+		String showAction = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_SHOW_ACT);
+		String compilersShowOption = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_SHOW_OPT_COMPILERS);
+		String devkitsShowOption = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_SHOW_OPT_DEVKITS);
+		String cpuTranspShowOption = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_SHOW_OPT_CPU);
+		AbstractSB1Command scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+
+		String stringShow = scratchboxCommandA.replaceScratchboxConfigCommand(
+				showAction, new String[] { compilersShowOption,
+						devkitsShowOption, cpuTranspShowOption });
+		assertEquals(stringToCompareA, stringShow.trim());
+
+		final String stringToCompareB = "sb-conf remove SDK_ARMEL";
+		String removeAction = sb1Sdk.getPreferenceValue(
+				SB1PreferenceConstants.SB1_REMOVE_ACT);
+		String stringRemove = scratchboxCommandA
+				.replaceScratchboxConfigCommand(removeAction,
+						new String[] { "SDK_ARMEL" });
+		assertEquals(stringToCompareB, stringRemove);
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,527 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.junit.Test;
+import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
+import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.ProcessLauncherCreator;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+import java.util.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestScratchboxFacade extends TestCase {
+	
+	private IScratchbox1SDK sdk;
+	static private List<String> cachedCputransps;
+	static private List<String> cachedCompilers;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		this.sdk = ScratchboxSDKFacade.getInstance().getScratchboxSDK(IScratchbox1SDK.class).get(0);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getInstance()}.
+	 */
+//	@Test
+//	public void testGetInstance() {
+//		ScratchboxFacade facadeA = ScratchboxFacade.getInstance();
+//		ScratchboxFacade facadeB = ScratchboxFacade.getInstance();
+//		assertSame(facadeA, facadeB);
+//	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getCompilers()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetCompilers() throws MicaException {
+		List<String> compilersExpected = new ArrayList<String>();
+		compilersExpected.add("host-gcc");
+		compilersExpected.add("cs2005q3.2-glibc-arm");
+		compilersExpected.add("cs2005q3.2-glibc-i386");
+		compilersExpected.add("cs2005q3.2-glibc2.5-arm");
+		compilersExpected.add("cs2005q3.2-glibc2.5-i386");
+
+		List<String> compilers = getCompilers();
+
+		// just make sure there is at least one compiler and that one of them looks like
+		// something we recognize
+		boolean matched = false;
+		for (String compiler : compilers) {
+			assertTrue(compiler.length() > 0);
+			if (compilers.contains(compiler))
+				matched = true;
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < compilersExpected.size(); i++) {
+			assertTrue(compilers.contains(compilersExpected.get(i)));
+		}
+		*/
+	}
+
+	/**
+	 * @return
+	 * @throws MicaException
+	 */
+	private List<String> getCompilers() throws MicaException {
+		if (cachedCompilers == null)
+			cachedCompilers = sdk.getCompilers();//ScratchboxFacade.getInstance().getCompilers(sdk);
+		List<String> compilers = cachedCompilers;
+		return compilers;
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getCputransp()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetCputransp() throws MicaException {
+		List<String> cputranspExpected = new ArrayList<String>();
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-m2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.0-m2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.2-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.7.0-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.1-sb2");
+		cputranspExpected
+				.add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.2-sb2");
+		cputranspExpected.add("/scratchbox/devkits/cputransp/bin/sbrsh");
+
+		List<String> cputransps = getCputransps();
+
+		// just make sure there is at least one cuptransp and that one of them looks like
+		// something we recognize
+		boolean matched = false;
+		for (String cputransp : cputransps) {
+			assertTrue(cputransp.length() > 0);
+			if (cputranspExpected.contains(cputransp))
+				matched = true;
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < cputranspExpected.size() && i < cputransp.size(); i++) {
+			assertTrue(cputransp.contains(cputranspExpected.get(i)));
+		}
+		*/
+	}
+
+	/**
+	 * @return
+	 * @throws MicaException
+	 */
+	private List<String> getCputransps() throws MicaException {
+		if (cachedCputransps == null)
+			cachedCputransps = sdk.getCputransp();//ScratchboxFacade.getInstance().getCputransp(sdk);
+		List<String> cputransps = cachedCputransps;
+		return cputransps;
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getDevkits()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetDevkits() throws MicaException {
+		List<String> devkitsExpected = new ArrayList<String>();
+		devkitsExpected.add("cputransp");
+		devkitsExpected.add("debian");
+		devkitsExpected.add("debian-sarge");
+		devkitsExpected.add("doctools");
+		devkitsExpected.add("perl");
+
+		List<String> devkits = ((IScratchbox1SDK)sdk).getDevkits();//ScratchboxFacade.getInstance().getDevkits(sdk);
+
+		// just make sure there is at leasr one devkit and that one of them looks like
+		// something we recognize
+		assertTrue(devkits.size() > 1);
+		boolean matched = false;
+		for (String devkit : devkits) {
+			assertTrue(devkit.length() > 0);
+			if (devkitsExpected.contains(devkit)) {
+				matched = true;
+			}
+		}
+		assertTrue(matched);
+		/*
+		for (int i = 0; i < devkitsExpected.size() && i < devkits.size(); i++) {
+			assertTrue(devkits.contains(devkitsExpected.get(i)));
+		}
+		*/
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getTargets()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetTargets() throws MicaException {
+		List<String> targetsExpected = new ArrayList<String>();
+		targetsExpected.add("SDK_ARMEL");
+		targetsExpected.add("SDK_X86");
+		targetsExpected.add("BORA_ARMEL");
+		targetsExpected.add("BORA_X86");
+		targetsExpected.add("CHINOOK_ARMEL");
+		targetsExpected.add("CHINOOK_X86");
+		targetsExpected.add("DIABLO_X86");
+		targetsExpected.add("DIABLO_ARMEL");
+
+		List<String> targets =  sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
+
+		// just make sure there is more than one target and that one of them looks like
+		// something we recognize
+		assertTrue(targets.size() > 1);
+		boolean matched = false;
+		for (String target : targets) {
+			assertTrue(target.length() > 0);
+			if (targetsExpected.contains(target)) {
+				matched = true;
+			}
+		}
+		assertTrue(matched);
+
+		/*
+		for (int i = 0; i < targetsExpected.size() && i < targets.size(); i++) {
+			assertTrue(targets.contains(targetsExpected.get(i)));
+		}*/
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getSessions()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetSessions() throws Exception {
+		if (HostUtils.isWindows()) {
+			System.out.println("PTY support doesn't work, skipping test");
+			return;
+		}
+			
+		int numberOfSessions = 0;
+
+//		List<String> sessions = ScratchboxFacade.getInstance().getSessions(sdk);
+		List<String> sessions = sdk.getSessions();
+
+		// make sure anything here is a pid
+		for (String pid : sessions) {
+			Integer.parseInt(pid);
+		}
+
+		numberOfSessions = sessions.size();
+		
+		// launch a new session (without switching targets!)
+//		ISDKTarget target = ScratchboxFacade.getInstance().getCurrentSDKTarget(ScratchboxSDKFacade.getInstance().getScratchbox1SDK());
+		ISDKTarget target = ScratchboxSDKFacade.getInstance().getScratchboxSDK(Scratchbox1SDK.class).get(0).getCurrentSDKTarget();
+		Process process = null;
+		try {
+			// need a PTY or else the shell fails to launch
+			IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(target.getProcessLauncherFactory(), null,
+					Collections.singletonList("/bin/sh"), null);
+			launcher.usePTY(true);
+			process = launcher.createProcess();
+			
+			// wait for it to really start
+			Thread.sleep(5000);
+		
+			sessions = sdk.getSessions();// ScratchboxFacade.getInstance().getSessions(sdk);
+			
+			// this either launches 1 or 2 processes
+			assertTrue(numberOfSessions < sessions.size());
+	
+			// make sure anything here is a pid
+			for (String pid : sessions) {
+				Integer.parseInt(pid);
+			}
+		} catch (Exception e) {
+			fail("Exception: "+e.getMessage());
+		}finally {		
+			// kill the shell (exit, then send ctrl-d)
+			process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
+			process.destroy();
+		}
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getCurrentTarget()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetCurrentTarget() throws MicaException {
+		String currentTarget = sdk.getCurrentTarget();//ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+		assertTrue(currentTarget.length() > 0);
+		assertNotNull(sdk.findSDKTarget(currentTarget));
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#createTarget(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+	 * and
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#removeTarget(java.lang.String)}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testCreateAndRemoveTarget() throws MicaException {
+		final String TARGET_NAME = "TEST_TARGET";
+
+		// pick actual compiler and cputransp
+		List<String> compilers = getCompilers();
+		String compiler = "host-gcc";
+		for (String c : compilers) {
+			if (c.matches("cs2005.*arm")) {
+				compiler = c;
+				break;
+			}
+		}
+		List<String> cputransps = getCputransps();
+		String cputransp = "sbrsh";
+		for (String c : cputransps) {
+			if (c.matches("qemu.*arm.*sb2")) {
+				cputransp = c;
+				break;
+			}
+		}
+		
+		
+		sdk.createTarget(
+				TARGET_NAME,
+				compiler, 
+				"doctools:cputransp",
+				cputransp);
+
+		List<String> targetsAvailable = sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
+		assertTrue(targetsAvailable.contains(TARGET_NAME));
+
+		// remove the target created for the test
+//		assertTrue(ScratchboxFacade.getInstance().removeTarget(sdk, TARGET_NAME));
+		assertTrue(sdk.removeTarget(TARGET_NAME));
+
+		targetsAvailable = sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
+		assertTrue(!targetsAvailable.contains(TARGET_NAME));
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#selectTarget(java.lang.String)}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testSelectTarget() throws MicaException {
+		final String TARGET_DOESNT_EXIST = "GHOST";
+
+		try {
+//			ScratchboxFacade.getInstance().removeTarget(sdk, TARGET_DOESNT_EXIST);
+			sdk.removeTarget(TARGET_DOESNT_EXIST);
+			fail("The target " + TARGET_DOESNT_EXIST
+					+ " does not exist. An error must be throwed.");
+		} catch (MicaException e) {
+			// the test is OK, so far.
+		}
+
+		// find a known target which isn't the current one
+		List<String> targets = sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
+		
+		String currentTarget = sdk.getCurrentTarget();//ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+		
+		String theTarget = null;
+		for (String target : targets) {
+			if (!target.equals(currentTarget)) {
+				theTarget = target;
+				break;
+			}
+		}
+
+		String lastTarget = sdk.getCurrentTarget();//ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+		assertTrue(lastTarget != null && lastTarget.length() > 0);
+
+//		assertTrue(ScratchboxFacade.getInstance().selectTarget(sdk, theTarget));
+		assertTrue(sdk.selectTarget(theTarget));
+
+		currentTarget = sdk.getCurrentTarget();//ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+		assertEquals(theTarget, currentTarget);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getCurrentSbox1Version()}.
+	 * 
+	 * @throws MicaException
+	 */
+	@Test
+	public void testGetCurrentSboxVersion() {
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			String sbox1Version;
+			try {
+				sbox1Version = Scratchbox1SDK.getCurrentSboxVersion(machine);//ScratchboxFacade.getInstance().getCurrentSbox1Version(machine);
+				assertTrue(sbox1Version.matches("1\\.0\\.\\d+"));
+			} catch (MicaException e) {
+				System.out.println("No Scratchbox 1 on " + machine);
+			}
+			String sbox2Version;
+			try {
+				sbox2Version = Scratchbox2SDK.getCurrentSboxVersion(machine);//ScratchboxFacade.getInstance().getCurrentSbox1Version(machine);
+				assertTrue(sbox2Version.matches("1\\.99\\..*|2\\..*"));
+			} catch (MicaException e) {
+				System.out.println("No Scratchbox 2 on " + machine);
+			}
+		}
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#configureSbrsh(java.lang.String, java.lang.String, java.lang.String)}.
+	 */
+	@Test
+	public void testConfigureSbrsh() {
+		// fail("Not yet implemented");
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#addSbrshAccessList(java.lang.String, java.lang.String, java.lang.String)}.
+	 */
+	@Test
+	public void testAddSbrshAccessList() {
+		// fail("Not yet implemented");
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#mountTarget(java.lang.String)}.
+	 */
+	@Test
+	public void testMountTarget() {
+		// fail("Not yet implemented");
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#unmountTarget(java.lang.String)}.
+	 */
+	@Test
+	public void testUnmountTarget() {
+		// fail("Not yet implemented");
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#showTarget(java.lang.String)}.
+	 * 
+	 * @throws ESboxException
+	 */
+	/* 
+	@Test
+	public void testShowTarget() throws ESboxException {
+		final String TARGET_ARMEL = "SDK_ARMEL";
+
+		ScratchboxTarget target = ScratchboxFacade.getInstance().showTarget(sdk,
+				TARGET_ARMEL);
+
+		assertEquals(TARGET_ARMEL, target.getName());
+		assertEquals("cs2005q3.2-glibc-arm", target.getCompiler());
+		assertEquals("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2",
+				target.getCputransp());
+
+		List<String> devkitsExpected = new ArrayList<String>();
+		devkitsExpected.add("perl");
+		devkitsExpected.add("maemo3-tools");
+		devkitsExpected.add("doctools");
+		devkitsExpected.add("debian-sarge");
+		devkitsExpected.add("maemo3-debian");
+		devkitsExpected.add("cputransp");
+
+		List<String> devkitsActual = target.getDevkits();
+		for (String devkit : devkitsActual) {
+			assertTrue(devkitsExpected.contains(devkit));
+		}
+	}
+	*/
+
+	/**
+	 * Test method for
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#execSimpleCommand(java.lang.String)}.
+	 * 
+	 * @throws ESboxException
+	 */
+//	@Test
+//	public void testExecSimpleCommand() throws ESboxException {
+//		ISDKTarget sdkTarget = sdk.getSDKTargets()[0];
+//		List<String> currentTarget = ScratchboxFacade.getInstance().execSimpleCommand(
+//				sdkTarget, 
+//				CommandLineArguments.createFromVarArgs("sb-conf", "current"));
+//		assertEquals(sdkTarget.getName(), currentTarget.get(0));
+//	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSelectTargetCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSelectTargetCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSelectTargetCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb1.command.*;
+import org.maemo.esbox.scratchbox.core.command.ScratchboxCommand;
+import org.maemo.mica.common.core.MicaException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestSelectTargetCommand extends BaseTest {
+
+	public void testPerformCommand() throws MicaException {
+		final String TARGET_DOESNT_EXIST = "GHOST";
+		
+
+		ScratchboxCommand selectCommand = new SelectTargetCommand(sb1Command, sb1Sdk);
+
+		List<String> param = new ArrayList<String>();
+
+		try {
+			selectCommand.performCommand(param);
+			fail("Invalid number of param");
+		} catch (MicaException e) {
+			// the test is OK, so far.
+		}
+
+		param.add(TARGET_DOESNT_EXIST);
+
+		try {
+			selectCommand.performCommand(param);
+			fail("The target " + TARGET_DOESNT_EXIST
+					+ " does not exist. An error must be throwed.");
+		} catch (MicaException e) {
+			// the test is OK, so far.
+		}
+		
+		// find a known target which isn't the current one
+		ListTargetsCommand listTargets = new ListTargetsCommand(sb1Command);
+		param.clear();
+		List<String> targets = listTargets.performCommand(param);
+		
+		GetCurrentTargetCommand currentTargetCommand = new GetCurrentTargetCommand(sb1Command, sb1Sdk);
+		String currentTarget = currentTargetCommand.performCommand(param);
+		String firstTarget = currentTarget;
+		
+		String theTarget = null;
+		for (String target : targets) {
+			if (!target.equals(currentTarget)) {
+				theTarget = target;
+				break;
+			}
+		}
+
+		// switch to the other target
+		ScratchboxCommand selectTargetCommand = new SelectTargetCommand(sb1Command, sb1Sdk);
+		param.clear();
+		param.add(theTarget);
+		assertTrue((Boolean) selectTargetCommand.performCommand(param));
+
+		String lastTarget = currentTargetCommand
+				.performCommand(new ArrayList<String>());
+		assertEquals(theTarget, lastTarget);
+
+		// siwtch back to the original target
+		param.clear();
+		param.add(currentTarget);
+		assertTrue((Boolean) selectTargetCommand.performCommand(param));
+
+		currentTarget = currentTargetCommand
+				.performCommand(new ArrayList<String>());
+		assertEquals(firstTarget, currentTarget);
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowPathMappingSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowPathMappingSb2Command.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowPathMappingSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,45 @@
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.internal.scratchbox.sb2.command.ShowPathMappingSb2Command;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.IFileSystemAccess;
+
+import java.util.*;
+
+public class TestShowPathMappingSb2Command extends BaseTest {
+
+	public void testPerformCommand() throws MicaException {
+		if (sb2ArmelTargetCommand == null)
+			return;
+			
+		ShowPathMappingSb2Command showPathsCommand = new ShowPathMappingSb2Command(
+				sb2ArmelTargetCommand);
+
+		List<String> param = new ArrayList<String>();
+
+		param.add("/");
+		param.add("/var/log");
+		param.add("/usr/include");
+		param.add("/usr/lib/libc.so");
+		param.add("/home");
+		
+		Map<IPath, IPath> mapping = showPathsCommand.performCommand(param);
+
+		assertNotNull(mapping);
+		
+		assertEquals(param.size(), mapping.size());
+		
+		IFileSystemAccess fileSystemAccess = sb2Sdk.getMachineFileSystemAccess();
+		for (Map.Entry<IPath, IPath> entry : mapping.entrySet()) {
+			if (fileSystemAccess.getFileStore(entry.getKey()).fetchInfo().exists()) {
+				assertNotNull(entry.getValue());
+				assertTrue(entry.getKey().toOSString(), param.contains(entry.getKey().toPortableString()));
+				assertTrue(entry.getValue().toString(),
+						fileSystemAccess.getFileStore(entry.getValue()).fetchInfo().exists()
+							);
+			}
+		}
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowTargetCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowTargetCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestShowTargetCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.maemo.esbox.internal.scratchbox.sb1.command.ShowTargetCommand;
+import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
+import org.maemo.esbox.scratchbox.core.command.ScratchboxCommand;
+import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxTarget;
+import org.maemo.mica.common.core.MicaException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestShowTargetCommand extends BaseTest {
+
+	public void testPerformCommand() throws MicaException {
+		String theTarget = sb1Sdk.getSDKTargetNames()[0];
+
+		ScratchboxCommand showTargetCommand = new ShowTargetCommand(sb1Command);
+		List<String> param = new ArrayList<String>();
+
+		ScratchboxTarget target = null;
+		try {
+			showTargetCommand.performCommand(param);
+			fail("Number of args is invalid");
+		} catch (MicaException e) {
+			// expected
+		}
+		param.add(theTarget);
+
+		target = (ScratchboxTarget) showTargetCommand.performCommand(param);
+
+		assertEquals(theTarget, target.getName());
+		assertTrue(sb1Sdk.getCompilers().contains(
+				target.getCompiler()));
+		assertTrue(sb1Sdk.getCputransp().contains(
+				target.getCputransp()));
+		
+		List<String> devkitsInstalled = ((Scratchbox1SDK)sb1Sdk).getDevkits();
+		
+		List<String> devkitsActual = target.getDevkits();
+		for (String devkit : devkitsActual) {
+			assertTrue(devkitsInstalled.contains(devkit));
+		}
+
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSimpleCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSimpleCommand.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestSimpleCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (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:
+ *    Raul Herbster (UFCG) - initial API and implementation
+ *    Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.scratchbox.tests.commands;
+
+import org.junit.Test;
+import org.maemo.esbox.internal.api.scratchbox.core.commands.SimpleCommand;
+import org.maemo.mica.common.core.MicaException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 
+ */
+public class TestSimpleCommand extends BaseTest {
+
+	/**
+	 * Test method for {@link org.maemo.esbox.internal.api.scratchbox.core.commands.common.core.command.scratchbox.SimpleCommand#performCommand(java.util.List)}.
+	 * @throws MicaException 
+	 */
+	@Test
+	public void testPerformCommand() throws MicaException {
+//		String currentTarget = ScratchboxFacade.getInstance().getCurrentTarget(sb1Sdk);
+		String currentTarget = sb1Sdk.getCurrentTarget();
+		
+		SimpleCommand simpleCommand = new SimpleCommand(sb1Command);
+		List<String> params = new ArrayList<String>();
+		
+		List<String> stdoutLines = null;
+		try {
+			simpleCommand.performCommand(params);
+			fail("Invalid number of params");
+		} catch (MicaException e) {
+			
+		}
+		params.add("sb-conf");
+		params.add("current");
+		
+		stdoutLines = simpleCommand.performCommand(params);
+		assertEquals(currentTarget, stdoutLines.get(0));
+	}
+
+}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/plugin.xml
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/plugin.xml	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/plugin.xml	2008-11-03 13:32:15 UTC (rev 916)
@@ -27,14 +27,14 @@
       </factory>
       <factory
             adaptableType="org.maemo.mica.common.core.sdk.ISDKTarget"
-            class="org.maemo.esbox.internal.scratchbox.sb1.ui.adapters.Scratchbox1PrepareTargetProcessLaunchAdapterFactory">
+            class="org.maemo.esbox.internal.scratchbox.sb1.launcher.Scratchbox1PrepareTargetProcessLaunchAdapterFactory">
          <adapter
                type="org.maemo.mica.common.core.adapters.IPrepareTargetProcessLaunchAdapter">
          </adapter>
       </factory>
       <factory
             adaptableType="org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDKTarget"
-            class="org.maemo.esbox.internal.scratchbox.sb1.ui.adapters.Sb1MaemoLauncherAdapterFactory">
+            class="org.maemo.esbox.internal.scratchbox.sb1.launcher.Sb1MaemoLauncherAdapterFactory">
          <adapter
                type="org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter">
          </adapter>

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1FileSystemMapping.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1FileSystemMapping.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1FileSystemMapping.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,70 +1,77 @@
-/**
- * (c) 2008 Nokia
- */
-package org.maemo.esbox.internal.scratchbox.sb1.core;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.mica.internal.api.common.core.machine.FileSystemMapping;
-
-import com.nokia.cpp.internal.api.utils.core.Pair;
-
-/**
- * Represent the mappings from the machine to a Scratchbox 1 target running on
- * the machine. This represents the direct mappings with all softlinks resolved
- * (so, not "/scratchbox/users/user/usr" but
- * "/scratchbox/users/user/targets/CHINOOK_ARMEL/usr")
- * 
- * @author eswartz
- * 
- */
-public class Scratchbox1FileSystemMapping extends FileSystemMapping {
-
-	/**
-	 * Construct with default Linux path canonicalizers and add mappings for
-	 * paths known to be mapped.
-	 * 
-	 * @param targetRoot
-	 * @param target
-	 */
-	public Scratchbox1FileSystemMapping(IPath scratchboxBase, String target,
-			String user) {
-
-		super(FileSystemMapping.getMachineCanonicalizer(true),
-				FileSystemMapping.getMachineCanonicalizer(true));
-
-		List<Pair<IPath, IPath>> mappings = getHostToTargetRootMappings();
-		mappings.clear();
-
-		// directories that are the same for all targets
-		String[] topLevelDirs = { "dev", "home", "host_usr", "proc",
-				"scratchbox", "sys", "targets" };
-
-		IPath sharedBase = scratchboxBase;
-		map(mappings, sharedBase, new Path("/"));
-		for (String topLevelDir : topLevelDirs) {
-			map(mappings, sharedBase.append(topLevelDir), new Path(topLevelDir)
-					.makeAbsolute());
-		}
-
-		// directories that depend on the current target
-		String[] topLevelLinks = { "bin", "boot", "cdrom", "etc", "floppy",
-				"initrd", "lib", "media", "mnt", "opt", "root", "sbin", "srv",
-				"usr", "var" };
-
-		IPath perTargetBase = scratchboxBase.append("targets").append(target);
-		for (String topLevelDir : topLevelLinks) {
-			map(mappings, perTargetBase.append(topLevelDir), new Path(
-					topLevelDir).makeAbsolute());
-		}
-
-		setHostToTargetRootMappings(mappings);
-	}
-
-	private void map(List<Pair<IPath, IPath>> mappings, IPath from, IPath to) {
-		mappings.add(new Pair<IPath, IPath>(from, to));
-	}
-
-}
+/*******************************************************************************
+ * 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.scratchbox.sb1.core;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.mica.internal.api.common.core.machine.FileSystemMapping;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+/**
+ * Represent the mappings from the machine to a Scratchbox 1 target running on
+ * the machine. This represents the direct mappings with all softlinks resolved
+ * (so, not "/scratchbox/users/user/usr" but
+ * "/scratchbox/users/user/targets/CHINOOK_ARMEL/usr")
+ * 
+ * @author eswartz
+ * 
+ */
+public class Scratchbox1FileSystemMapping extends FileSystemMapping {
+
+	/**
+	 * Construct with default Linux path canonicalizers and add mappings for
+	 * paths known to be mapped.
+	 * 
+	 * @param targetRoot
+	 * @param target
+	 */
+	public Scratchbox1FileSystemMapping(IPath scratchboxBase, String target,
+			String user) {
+
+		super(FileSystemMapping.getMachineCanonicalizer(true),
+				FileSystemMapping.getMachineCanonicalizer(true));
+
+		List<Pair<IPath, IPath>> mappings = getHostToTargetRootMappings();
+		mappings.clear();
+
+		// directories that are the same for all targets
+		String[] topLevelDirs = { "dev", "home", "host_usr", "proc",
+				"scratchbox", "sys", "targets" };
+
+		IPath sharedBase = scratchboxBase;
+		map(mappings, sharedBase, new Path("/"));
+		for (String topLevelDir : topLevelDirs) {
+			map(mappings, sharedBase.append(topLevelDir), new Path(topLevelDir)
+					.makeAbsolute());
+		}
+
+		// directories that depend on the current target
+		String[] topLevelLinks = { "bin", "boot", "cdrom", "etc", "floppy",
+				"initrd", "lib", "media", "mnt", "opt", "root", "sbin", "srv",
+				"usr", "var" };
+
+		IPath perTargetBase = scratchboxBase.append("targets").append(target);
+		for (String topLevelDir : topLevelLinks) {
+			map(mappings, perTargetBase.append(topLevelDir), new Path(
+					topLevelDir).makeAbsolute());
+		}
+
+		setHostToTargetRootMappings(mappings);
+	}
+
+	private void map(List<Pair<IPath, IPath>> mappings, IPath from, IPath to) {
+		mappings.add(new Pair<IPath, IPath>(from, to));
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapter.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.sb1.launcher;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.ui.console.IPatternMatchListener;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.PatternMatchEvent;
+import org.eclipse.ui.console.TextConsole;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
+import org.maemo.esbox.internal.scratchbox.sb1.Activator;
+import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDKTarget;
+import org.maemo.mica.common.core.CoreConsoleManager;
+import org.maemo.mica.common.core.CorePreferenceManager;
+import org.maemo.mica.common.core.ErrorLogger;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.IProcess;
+import org.maemo.mica.common.core.machine.ProcessFilterCmdLineRegexp;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.ProcessLauncherCreator;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+public class Sb1MaemoLauncherAdapter implements IMaemoLauncherAdapter{
+	
+	private static final String MAEMO_LAUNCHER_APP = "maemo-launcher";
+	private final IScratchbox1SDKTarget target;
+	private final MaemoCommand command;
+	
+	public Sb1MaemoLauncherAdapter(IScratchbox1SDKTarget target){
+		this.target = target;
+		this.command = new MaemoCommand(target);
+	}
+
+	@Override
+	public void killMaemo() throws MicaException {
+		List<IProcess> pids = getMaemoLaunchers(target.getSDK().getMachine());
+		if (pids.size() == 0)
+			return;
+
+		try {
+			for (IProcess process : pids) {
+				process.terminate();
+			}
+		} catch (IOException e) {
+
+		}
+
+		// try again
+		pids = getMaemoLaunchers(target.getSDK().getMachine());
+		if (pids.size() == 0)
+			return;
+
+		try {
+			for (IProcess process : pids) {
+				process.kill();
+			}
+		} catch (IOException e) {
+			throw new MicaException("Could not kill " + MAEMO_LAUNCHER_APP, e);
+		}
+		
+	}
+
+	@Override
+	public void restartMaemo() throws MicaException {
+		command.restartMaemoCommand();
+		
+	}
+
+	@Override
+	public void startMaemo() throws MicaException {
+		if (isMaemoRunning())
+			throw new MicaException("Maemo is already running");
+		XLauncher.getInstance().startXIfNeeded(target);
+		if (XLauncher.getInstance().isXServerStarted(target)) {
+			command.startMaemoCommand();
+		}
+		
+		
+	}
+
+	@Override
+	public void stopMaemo() throws MicaException {
+		command.stopMaemoCommand();
+		
+	}
+
+	
+	
+	@Override
+	public boolean isMaemoRunning() throws MicaException {
+		List<IProcess> runningProcesses = getMaemoLaunchers(target.getSDK()
+				.getMachine());
+		return runningProcesses.size() > 0;
+	}
+
+	private List<IProcess> getMaemoLaunchers(IMachine machine) {
+		// includes scratchbox call that launched maemo-launcher
+		List<IProcess> runningProcesses = machine.getProcessLister()
+				.getProcesses(
+						new ProcessFilterCmdLineRegexp(".*/"
+								+ MAEMO_LAUNCHER_APP + "\\s+.*"));
+		return runningProcesses;
+	}
+	
+	static class MaemoCommand {
+
+		private ISDKTarget sdkTarget;
+
+		public MaemoCommand(ISDKTarget sdkTarget) {
+			this.sdkTarget = sdkTarget;
+		}
+
+		private void performCommand(List<String> params) throws MicaException {
+			String maemoCommand = sdkTarget.getPreferenceValue(
+					MaemoPreferenceConstants.MAEMO_COMMAND);
+			maemoCommand = this.replaceActions(maemoCommand,params.get(0));
+			
+			IProcessLauncherFactory processLauncherFactory = sdkTarget.getProcessLauncherFactory();
+			
+			IEnvironmentModifierBlock envBlock = processLauncherFactory.defaultEnvironmentModifierBlock();
+			
+			defineEmulatorXDisplayVariable(sdkTarget.getSDK().getMachine(), envBlock);
+			
+			IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, null,
+					Collections.singletonList(maemoCommand), envBlock);
+
+			Process process = processLauncher.createProcess();
+
+			// spit the consumed output to the console
+			MessageConsole console = CoreConsoleManager.getInstance().getConsole(true,
+					sdkTarget, "Running Maemo command (" + params.get(0) + ")");
+
+			console.addPatternMatchListener(new IPatternMatchListener() {
+
+				public int getCompilerFlags() {
+					return 0;
+				}
+
+				public String getLineQualifier() {
+					return null;
+				}
+
+				public String getPattern() {
+					return "ERROR:.*";
+				}
+
+				public void connect(TextConsole console) {
+				}
+
+				public void disconnect() {
+				}
+
+				public void matchFound(PatternMatchEvent event) {
+					TextConsole console = (TextConsole) event.getSource();
+					String content;
+					try {
+						content = console.getDocument().get(event.getOffset(),
+								event.getLength());
+					} catch (BadLocationException e) {
+						content = console.getDocument().get();
+					}
+					ErrorLogger errorLogger = Activator.getErrorLogger();
+					errorLogger.logAndShowError("Error launching maemo",
+							new MicaException(content));
+				}
+
+			});
+
+			// emit everything else to the console
+			processLauncher.redirectToConsole(console);
+
+			// wait for it to finish
+			try {
+				process.waitFor();
+			} catch (InterruptedException e) {
+
+			}
+		}
+
+		public static void defineEmulatorXDisplayVariable(IMachine serverMachine, IEnvironmentModifierBlock envBlock) {
+			// local launches need DISPLAY that points back to the host machine
+			String display = CorePreferenceManager.getInstance().getRegisteredKeyValue(
+					MaemoPreferenceConstants.X_DISPLAY);
+			if (display != null && display.length() > 0) {
+				String host = serverMachine.getLocalMachineAddress();
+				if (host.equals(IMachine.LOCALHOST_ADDRESS)) {
+					host = "";
+				}
+				envBlock.define("DISPLAY", host + display);
+			}
+		}
+		
+		public void startMaemoCommand() throws MicaException {
+			if (sdkTarget == null) {
+				throw new MicaException("No SDK target specified");
+			}
+
+			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_START_ACTION);
+
+			performCommand(params);
+		}
+
+		public void stopMaemoCommand() throws MicaException {
+			if (sdkTarget == null) {
+				throw new MicaException("No SDK target specified");
+			}
+			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_STOP_ACTION);
+			performCommand(params);
+		}
+
+		public void restartMaemoCommand()
+				throws MicaException {
+			if (sdkTarget == null) {
+				throw new MicaException("No SDK target specified");
+			}
+
+			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_RESTART_ACTION);
+			performCommand(params);
+		}
+
+		private List<String> getParamList(String key) {
+			List<String> params = new ArrayList<String>();
+			params.add(sdkTarget.getPreferenceValue(key));
+			return params;
+		}
+
+		private String replaceActions(String command, String action) {
+			return command.replaceAll("\\$\\{ACTIONS\\}", action);
+		}
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapterFactory.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Sb1MaemoLauncherAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.sb1.launcher;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDKTarget;
+
+public class Sb1MaemoLauncherAdapterFactory implements IAdapterFactory {
+
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if (adapterType.equals(IMaemoLauncherAdapter.class)) {
+			if (adaptableObject instanceof IScratchbox1SDKTarget) {
+				return new Sb1MaemoLauncherAdapter((IScratchbox1SDKTarget)adaptableObject);
+			}
+		}
+		return null;
+	}
+
+	@Override
+	public Class[] getAdapterList() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * 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
+ *	  Petr Baranov (Noki) - move to sb1 
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.sb1.launcher;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
+import org.maemo.esbox.internal.scratchbox.sb1.Activator;
+import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.mica.common.core.GeneralUtils;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.adapters.IPrepareTargetProcessLaunchAdapter;
+import org.maemo.mica.common.core.process.CommandLineArguments;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.ProcessLauncherCreator;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+/**
+ * Utility class to handle switching scratchbox targets and get user approval to
+ * kill existing sessions if needed.
+ * 
+ * @author eswartz
+ * 
+ */
+public class Scratchbox1PrepareTargetProcessLaunchAdapter implements IPrepareTargetProcessLaunchAdapter {
+
+	private final ISDKTarget sdkTarget;
+	public Scratchbox1PrepareTargetProcessLaunchAdapter(ISDKTarget sdkTarget) {
+		this.sdkTarget = sdkTarget;
+	}
+	
+	public void prepareTargetForProcessLaunch() throws MicaException {
+		IScratchbox1SDK sdk = ((IScratchbox1SDK) sdkTarget.getSDK());
+		final String currentTarget = sdk.getCurrentTarget();
+		final String targetName = sdkTarget.getName();
+		if (currentTarget.equals(targetName)) {
+			return;
+		}
+
+		// see if maemo is running, since it needs to be killed to switch
+		// targets
+		// but isn't considered a "session" every time
+		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter)sdkTarget.getAdapter(IMaemoLauncherAdapter.class);
+		if(launcher == null){
+			// TODO: throw exception
+		}
+
+		// now try to switch and see if shells are open
+		boolean failedToSwitch = false;
+		try {
+			sdk.selectTarget(targetName);
+		} catch (final ScratchboxException e) {
+			// sb-conf: You must close your other Scratchbox sessions first
+			// or
+			// Note: Couldn't reselect the target. There are other Scratchbox
+			// sessions open.
+			if (e.getLocalizedMessage().contains("Scratchbox sessions")) {
+				failedToSwitch = true;
+			} else {
+				throw e;
+			}
+		}
+
+		if (launcher.isMaemoRunning() || failedToSwitch) {
+			final boolean[] ret = { false };
+
+			if (!GeneralUtils.isJUnitRunning()) {
+				Display.getDefault().syncExec(new Runnable() {
+					public void run() {
+						ret[0] = MessageDialog.openQuestion(null,
+							"Scratchbox Target Conflict",
+							MessageFormat.format(
+								"The scratchbox 1 target needs to be switched from ''{0}'' to ''{1}'', but existing sessions are active.\n\n"
+									+ "Kill existing Scratchbox sessions?  (You may manually close them first, if desired, then select 'No' to retry)",
+							currentTarget,
+							targetName));
+					};
+				});
+			} else {
+				ret[0] = true;
+			}
+
+			// if user accepts, kill existing ones
+			if (ret[0]) {
+				if (launcher.isMaemoRunning()) {
+					// a target selection may succeed even if X and maemo are
+					// running... kill them first.
+					// We kill X too because some processes won't be killed by
+					// maemo-launcher.
+					try {
+						launcher.killMaemo();
+					} catch (MicaException e2) {
+						// ignore
+					}
+					try {
+						XLauncher.getInstance().stopX(sdkTarget);
+					} catch (MicaException e2) {
+						// ignore
+					}
+				}
+
+				// now kill the scratchbox sessions the "approved" way
+				try {
+					sdk.killProcess();
+
+					// wait politely
+					try {
+						Thread.sleep(1000);
+					} catch (InterruptedException e1) {
+
+					}
+
+				} catch (ScratchboxException e2) {
+					// sb-conf killall can fail in the event there is some
+					// process with a space in its
+					// name... just log it and keep going
+					Activator.getErrorLogger().logError(
+							"Problem killing scratchbox sessions", e2);
+				}
+
+				// double-check, since it doesn't really work!
+				List<String> sessions = sdk.getSessions();
+				if (sessions.size() > 0) {
+					// forcibly kill processes
+					List<String> cmdLine = CommandLineArguments
+							.createFromVarArgs("kill", "-9");
+					cmdLine.addAll(sessions);
+
+					IProcessLauncher processLauncher = ProcessLauncherCreator
+							.createProcessLauncher(sdk
+									.getMachineProcessLauncherFactory(), null,
+									cmdLine);
+					Process process;
+					try {
+						process = processLauncher.createProcess();
+						process.waitFor();
+					} catch (final Exception e1) {
+						Display.getDefault().syncExec(new Runnable() {
+							public void run() {
+								MessageDialog.openError(null, "Scratchbox Target Conflict",
+									MessageFormat.format(
+										"Couldn''t kill scratchbox processes:\n\n{0}\n\nRetrying the target selection anyway.",
+										e1.getLocalizedMessage()));
+							};
+						});
+					}
+				}
+
+			}
+
+			// always retry, and rethrow if fails
+			sdk.selectTarget(targetName);
+		}
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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
+ *    Petr Baranov (Nokia) - move to sb1
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.scratchbox.sb1.launcher;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.mica.common.core.adapters.IPrepareTargetProcessLaunchAdapter;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+
+/**
+ * 
+ * @author eswartz
+ *
+ */
+public class Scratchbox1PrepareTargetProcessLaunchAdapterFactory implements IAdapterFactory {
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+	 */
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if (adapterType.equals(IPrepareTargetProcessLaunchAdapter.class)) {
+			if (adaptableObject instanceof ISDKTarget
+					&& ((ISDKTarget) adaptableObject).getSDK() instanceof IScratchbox1SDK) {
+				ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
+				return new Scratchbox1PrepareTargetProcessLaunchAdapter(sdkTarget);
+			}
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+	 */
+	public Class[] getAdapterList() {
+		return new Class[] { IPrepareTargetProcessLaunchAdapter.class };
+	}
+
+}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapter.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,239 +0,0 @@
-package org.maemo.esbox.internal.scratchbox.sb1.ui.adapters;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
-import org.maemo.esbox.internal.scratchbox.sb1.Activator;
-import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
-import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDKTarget;
-import org.maemo.mica.common.core.CoreConsoleManager;
-import org.maemo.mica.common.core.CorePreferenceManager;
-import org.maemo.mica.common.core.ErrorLogger;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
-import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.IProcess;
-import org.maemo.mica.common.core.machine.ProcessFilterCmdLineRegexp;
-import org.maemo.mica.common.core.process.IProcessLauncher;
-import org.maemo.mica.common.core.process.IProcessLauncherFactory;
-import org.maemo.mica.common.core.process.ProcessLauncherCreator;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-
-public class Sb1MaemoLauncherAdapter implements IMaemoLauncherAdapter{
-	
-	private static final String MAEMO_LAUNCHER_APP = "maemo-launcher";
-	private final IScratchbox1SDKTarget target;
-	private final MaemoCommand command;
-	
-	public Sb1MaemoLauncherAdapter(IScratchbox1SDKTarget target){
-		this.target = target;
-		this.command = new MaemoCommand(target);
-	}
-
-	@Override
-	public void killMaemo() throws MicaException {
-		List<IProcess> pids = getMaemoLaunchers(target.getSDK().getMachine());
-		if (pids.size() == 0)
-			return;
-
-		try {
-			for (IProcess process : pids) {
-				process.terminate();
-			}
-		} catch (IOException e) {
-
-		}
-
-		// try again
-		pids = getMaemoLaunchers(target.getSDK().getMachine());
-		if (pids.size() == 0)
-			return;
-
-		try {
-			for (IProcess process : pids) {
-				process.kill();
-			}
-		} catch (IOException e) {
-			throw new MicaException("Could not kill " + MAEMO_LAUNCHER_APP, e);
-		}
-		
-	}
-
-	@Override
-	public void restartMaemo() throws MicaException {
-		command.restartMaemoCommand();
-		
-	}
-
-	@Override
-	public void startMaemo() throws MicaException {
-		if (isMaemoRunning())
-			throw new MicaException("Maemo is already running");
-		XLauncher.getInstance().startXIfNeeded(target);
-		if (XLauncher.getInstance().isXServerStarted(target)) {
-			command.startMaemoCommand();
-		}
-		
-		
-	}
-
-	@Override
-	public void stopMaemo() throws MicaException {
-		command.stopMaemoCommand();
-		
-	}
-
-	
-	
-	@Override
-	public boolean isMaemoRunning() throws MicaException {
-		List<IProcess> runningProcesses = getMaemoLaunchers(target.getSDK()
-				.getMachine());
-		return runningProcesses.size() > 0;
-	}
-
-	private List<IProcess> getMaemoLaunchers(IMachine machine) {
-		// includes scratchbox call that launched maemo-launcher
-		List<IProcess> runningProcesses = machine.getProcessLister()
-				.getProcesses(
-						new ProcessFilterCmdLineRegexp(".*/"
-								+ MAEMO_LAUNCHER_APP + "\\s+.*"));
-		return runningProcesses;
-	}
-	
-	static class MaemoCommand {
-
-		private ISDKTarget sdkTarget;
-
-		public MaemoCommand(ISDKTarget sdkTarget) {
-			this.sdkTarget = sdkTarget;
-		}
-
-		private void performCommand(List<String> params) throws MicaException {
-			String maemoCommand = sdkTarget.getPreferenceValue(
-					MaemoPreferenceConstants.MAEMO_COMMAND);
-			maemoCommand = this.replaceActions(maemoCommand,params.get(0));
-			
-			IProcessLauncherFactory processLauncherFactory = sdkTarget.getProcessLauncherFactory();
-			
-			IEnvironmentModifierBlock envBlock = processLauncherFactory.defaultEnvironmentModifierBlock();
-			
-			defineEmulatorXDisplayVariable(sdkTarget.getSDK().getMachine(), envBlock);
-			
-			IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, null,
-					Collections.singletonList(maemoCommand), envBlock);
-
-			Process process = processLauncher.createProcess();
-
-			// spit the consumed output to the console
-			MessageConsole console = CoreConsoleManager.getInstance().getConsole(true,
-					sdkTarget, "Running Maemo command (" + params.get(0) + ")");
-
-			console.addPatternMatchListener(new IPatternMatchListener() {
-
-				public int getCompilerFlags() {
-					return 0;
-				}
-
-				public String getLineQualifier() {
-					return null;
-				}
-
-				public String getPattern() {
-					return "ERROR:.*";
-				}
-
-				public void connect(TextConsole console) {
-				}
-
-				public void disconnect() {
-				}
-
-				public void matchFound(PatternMatchEvent event) {
-					TextConsole console = (TextConsole) event.getSource();
-					String content;
-					try {
-						content = console.getDocument().get(event.getOffset(),
-								event.getLength());
-					} catch (BadLocationException e) {
-						content = console.getDocument().get();
-					}
-					ErrorLogger errorLogger = Activator.getErrorLogger();
-					errorLogger.logAndShowError("Error launching maemo",
-							new MicaException(content));
-				}
-
-			});
-
-			// emit everything else to the console
-			processLauncher.redirectToConsole(console);
-
-			// wait for it to finish
-			try {
-				process.waitFor();
-			} catch (InterruptedException e) {
-
-			}
-		}
-
-		public static void defineEmulatorXDisplayVariable(IMachine serverMachine, IEnvironmentModifierBlock envBlock) {
-			// local launches need DISPLAY that points back to the host machine
-			String display = CorePreferenceManager.getInstance().getRegisteredKeyValue(
-					MaemoPreferenceConstants.X_DISPLAY);
-			if (display != null && display.length() > 0) {
-				String host = serverMachine.getLocalMachineAddress();
-				if (host.equals(IMachine.LOCALHOST_ADDRESS)) {
-					host = "";
-				}
-				envBlock.define("DISPLAY", host + display);
-			}
-		}
-		
-		public void startMaemoCommand() throws MicaException {
-			if (sdkTarget == null) {
-				throw new MicaException("No SDK target specified");
-			}
-
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_START_ACTION);
-
-			performCommand(params);
-		}
-
-		public void stopMaemoCommand() throws MicaException {
-			if (sdkTarget == null) {
-				throw new MicaException("No SDK target specified");
-			}
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_STOP_ACTION);
-			performCommand(params);
-		}
-
-		public void restartMaemoCommand()
-				throws MicaException {
-			if (sdkTarget == null) {
-				throw new MicaException("No SDK target specified");
-			}
-
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_RESTART_ACTION);
-			performCommand(params);
-		}
-
-		private List<String> getParamList(String key) {
-			List<String> params = new ArrayList<String>();
-			params.add(sdkTarget.getPreferenceValue(key));
-			return params;
-		}
-
-		private String replaceActions(String command, String action) {
-			return command.replaceAll("\\$\\{ACTIONS\\}", action);
-		}
-	}
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapterFactory.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Sb1MaemoLauncherAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,25 +0,0 @@
-package org.maemo.esbox.internal.scratchbox.sb1.ui.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDKTarget;
-
-public class Sb1MaemoLauncherAdapterFactory implements IAdapterFactory {
-
-	@Override
-	public Object getAdapter(Object adaptableObject, Class adapterType) {
-		if (adapterType.equals(IMaemoLauncherAdapter.class)) {
-			if (adaptableObject instanceof IScratchbox1SDKTarget) {
-				return new Sb1MaemoLauncherAdapter((IScratchbox1SDKTarget)adaptableObject);
-			}
-		}
-		return null;
-	}
-
-	@Override
-	public Class[] getAdapterList() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapter.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * 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.scratchbox.sb1.ui.adapters;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
-import org.maemo.esbox.internal.scratchbox.sb1.Activator;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
-import org.maemo.mica.common.core.GeneralUtils;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.adapters.IPrepareTargetProcessLaunchAdapter;
-import org.maemo.mica.common.core.process.CommandLineArguments;
-import org.maemo.mica.common.core.process.IProcessLauncher;
-import org.maemo.mica.common.core.process.ProcessLauncherCreator;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-
-/**
- * Utility class to handle switching scratchbox targets and get user approval to
- * kill existing sessions if needed.
- * 
- * @author eswartz
- * 
- */
-public class Scratchbox1PrepareTargetProcessLaunchAdapter implements IPrepareTargetProcessLaunchAdapter {
-
-	private final ISDKTarget sdkTarget;
-	public Scratchbox1PrepareTargetProcessLaunchAdapter(ISDKTarget sdkTarget) {
-		this.sdkTarget = sdkTarget;
-	}
-	
-	public void prepareTargetForProcessLaunch() throws MicaException {
-		IScratchbox1SDK sdk = ((IScratchbox1SDK) sdkTarget.getSDK());
-		final String currentTarget = sdk.getCurrentTarget();
-		final String targetName = sdkTarget.getName();
-		if (currentTarget.equals(targetName)) {
-			return;
-		}
-
-		// see if maemo is running, since it needs to be killed to switch
-		// targets
-		// but isn't considered a "session" every time
-		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter)sdkTarget.getAdapter(IMaemoLauncherAdapter.class);
-		if(launcher == null){
-			// TODO: throw exception
-		}
-
-		// now try to switch and see if shells are open
-		boolean failedToSwitch = false;
-		try {
-			sdk.selectTarget(targetName);
-		} catch (final ScratchboxException e) {
-			// sb-conf: You must close your other Scratchbox sessions first
-			// or
-			// Note: Couldn't reselect the target. There are other Scratchbox
-			// sessions open.
-			if (e.getLocalizedMessage().contains("Scratchbox sessions")) {
-				failedToSwitch = true;
-			} else {
-				throw e;
-			}
-		}
-
-		if (launcher.isMaemoRunning() || failedToSwitch) {
-			final boolean[] ret = { false };
-
-			if (!GeneralUtils.isJUnitRunning()) {
-				Display.getDefault().syncExec(new Runnable() {
-					public void run() {
-						ret[0] = MessageDialog.openQuestion(null,
-							"Scratchbox Target Conflict",
-							MessageFormat.format(
-								"The scratchbox 1 target needs to be switched from ''{0}'' to ''{1}'', but existing sessions are active.\n\n"
-									+ "Kill existing Scratchbox sessions?  (You may manually close them first, if desired, then select 'No' to retry)",
-							currentTarget,
-							targetName));
-					};
-				});
-			} else {
-				ret[0] = true;
-			}
-
-			// if user accepts, kill existing ones
-			if (ret[0]) {
-				if (launcher.isMaemoRunning()) {
-					// a target selection may succeed even if X and maemo are
-					// running... kill them first.
-					// We kill X too because some processes won't be killed by
-					// maemo-launcher.
-					try {
-						launcher.killMaemo();
-					} catch (MicaException e2) {
-						// ignore
-					}
-					try {
-						XLauncher.getInstance().stopX(sdkTarget);
-					} catch (MicaException e2) {
-						// ignore
-					}
-				}
-
-				// now kill the scratchbox sessions the "approved" way
-				try {
-					sdk.killProcess();
-
-					// wait politely
-					try {
-						Thread.sleep(1000);
-					} catch (InterruptedException e1) {
-
-					}
-
-				} catch (ScratchboxException e2) {
-					// sb-conf killall can fail in the event there is some
-					// process with a space in its
-					// name... just log it and keep going
-					Activator.getErrorLogger().logError(
-							"Problem killing scratchbox sessions", e2);
-				}
-
-				// double-check, since it doesn't really work!
-				List<String> sessions = sdk.getSessions();
-				if (sessions.size() > 0) {
-					// forcibly kill processes
-					List<String> cmdLine = CommandLineArguments
-							.createFromVarArgs("kill", "-9");
-					cmdLine.addAll(sessions);
-
-					IProcessLauncher processLauncher = ProcessLauncherCreator
-							.createProcessLauncher(sdk
-									.getMachineProcessLauncherFactory(), null,
-									cmdLine);
-					Process process;
-					try {
-						process = processLauncher.createProcess();
-						process.waitFor();
-					} catch (final Exception e1) {
-						Display.getDefault().syncExec(new Runnable() {
-							public void run() {
-								MessageDialog.openError(null, "Scratchbox Target Conflict",
-									MessageFormat.format(
-										"Couldn''t kill scratchbox processes:\n\n{0}\n\nRetrying the target selection anyway.",
-										e1.getLocalizedMessage()));
-							};
-						});
-					}
-				}
-
-			}
-
-			// always retry, and rethrow if fails
-			sdk.selectTarget(targetName);
-		}
-	}
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/adapters/Scratchbox1PrepareTargetProcessLaunchAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.scratchbox.sb1.ui.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
-import org.maemo.mica.common.core.adapters.IPrepareTargetProcessLaunchAdapter;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-
-/**
- * 
- * @author eswartz
- *
- */
-public class Scratchbox1PrepareTargetProcessLaunchAdapterFactory implements IAdapterFactory {
-
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
-	 */
-	public Object getAdapter(Object adaptableObject, Class adapterType) {
-		if (adapterType.equals(IPrepareTargetProcessLaunchAdapter.class)) {
-			if (adaptableObject instanceof ISDKTarget
-					&& ((ISDKTarget) adaptableObject).getSDK() instanceof IScratchbox1SDK) {
-				ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
-				return new Scratchbox1PrepareTargetProcessLaunchAdapter(sdkTarget);
-			}
-		}
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
-	 */
-	public Class[] getAdapterList() {
-		return new Class[] { IPrepareTargetProcessLaunchAdapter.class };
-	}
-
-}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDKTarget.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDKTarget.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDKTarget.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
 package org.maemo.esbox.scratchbox.sb1.sdk;
 
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/conf/sb2_prefs.xml
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/conf/sb2_prefs.xml	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/conf/sb2_prefs.xml	2008-11-03 13:32:15 UTC (rev 916)
@@ -10,7 +10,7 @@
 		WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs, 
 		adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
 
-	<entry key="SB2_MAPPING_MODE">maemo</entry>
+	<entry key="SB2_MAPPING_MODE">devel</entry>
 	<entry key="SB2_INSTALL_MAPPING_MODE">emulate</entry>
 	<entry key="SB2_LOG_LEVEL"></entry>
 	

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/plugin.xml
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/plugin.xml	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/plugin.xml	2008-11-03 13:32:15 UTC (rev 916)
@@ -27,7 +27,7 @@
       </factory>
       <factory
             adaptableType="org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget"
-            class="org.maemo.esbox.internal.scratchbox.sb2.ui.adapters.Sb2MaemoLauncherAdapterFactory">
+            class="org.maemo.esbox.internal.scratchbox.sb2.launcher.Sb2MaemoLauncherAdapterFactory">
          <adapter
                type="org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter">
          </adapter>

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/AbstractSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/AbstractSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/AbstractSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -10,20 +10,36 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.command;
 
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
 import org.maemo.esbox.scratchbox.core.command.AbstractSDKCommand;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.process.HostProcessLauncherFactory;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
 import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
 
 import java.security.InvalidParameterException;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 public abstract class AbstractSb2Command extends AbstractSDKCommand {
 
-	public AbstractSb2Command(ICommandAbstractor commandAbstractor) {
+	private final IProcessLauncherFactory processLauncherFactory;
+	
+	public AbstractSb2Command(ICommandAbstractor commandAbstractor, IProcessLauncherFactory launcherFactory) {
 		super(commandAbstractor);
+		processLauncherFactory = launcherFactory;
 	}
 
+	public AbstractSb2Command(ICommandAbstractor commandAbstractor){
+		super(commandAbstractor);
+		processLauncherFactory = null;
+	}
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -40,11 +56,14 @@
 		return replaceScratchboxCommand(sboxCommand, action, options);
 	}
 
-	protected List<String> createCLI(String...args) {
-		List<String> cli = new ArrayList<String>();
-		for(String arg:args){
-			cli.add(arg);
-		}
-		return cli;
+	protected Results runProcess(String...args) throws MicaException{
+		List<String> cli = Arrays.asList(args);
+		return ProcessLauncherUtils.launchAndReadStandardStreams(processLauncherFactory, cli);
 	}
+	
+	protected Results runProcess( IProgressMonitor monitor,String...args) throws MicaException{
+		List<String> cli = Arrays.asList(args);
+		IProcessLauncher launcher = processLauncherFactory.createProcessLauncher(null, cli,null);
+		return ProcessLauncherUtils.launchAndReadStandardStreams(launcher, monitor);
+	}
 }

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateMaemoRootstrapSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateMaemoRootstrapSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * 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.scratchbox.sb2.command;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.CoreConsoleManager;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
-import org.maemo.mica.common.core.process.ProcessLauncherUtils;
-import org.maemo.mica.common.core.sdk.ISDK;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Creates a new rootstrap for a target, if it does not exist. This command
- * wraps the callback to service:
- * <p>
- * maemo-rootstrap [--force] install &lt;target&gt;
- * 
- */
-public class CreateMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
-
-	private ISDK sdk;
-	private IProgressMonitor monitor;
-
-	public CreateMaemoRootstrapSb2Command(ISDK sdk,
-			ICommandAbstractor commandAbstractor, IProgressMonitor monitor) {
-		super(commandAbstractor);
-		this.sdk = sdk;
-		this.monitor = monitor;
-	}
-
-	protected boolean checkParameters(List<String> param) {
-		return param.size() == 3;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public Boolean performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String targetName = param.get(0);
-		String useHostToolsFlag = param.get(1);
-		String forceFlag = param.get(2);
-
-		List<String> params = new ArrayList<String>();
-		if (useHostToolsFlag.equals(Boolean.TRUE.toString())) {
-			params
-					.add(commandAbstractor
-							.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT));
-		}
-		if (forceFlag.equals(Boolean.TRUE.toString())) {
-			params
-					.add(commandAbstractor
-							.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT));
-		}
-		params
-				.add(commandAbstractor
-						.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_INSTALL_ACT));
-		params.add(targetName);
-
-		IEnvironmentModifierBlock envBlock = commandAbstractor
-				.getProcessLauncherFactory().defaultEnvironmentModifierBlock();
-		ProcessLauncherUtils.defineProxyVariables(envBlock);
-
-		setMonitorAndConsole(monitor, CoreConsoleManager.getInstance().getConsole(true,
-				null, "Installing rootstrap " + targetName));
-		doPerformCommand(params, envBlock, 0);
-
-		sdk.refresh();
-
-		return true;
-	}
-
-	public int getParametersSize() {
-		return 1;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateTargetSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateTargetSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/CreateTargetSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.internal.scratchbox.sb2.Activator;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.process.*;
-import org.maemo.mica.common.core.sdk.ISDK;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.List;
-
-/**
- * Creates a new target, if it does not exist. This command wraps the callback
- * to service:
- * <p>
- * sb2-init {flags} [targetname] [compiler]
- * 
- */
-public class CreateTargetSb2Command extends AbstractSb2Command {
-
-	private ISDK sdk;
-
-	public CreateTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-		this.sdk = sdk;
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return param.size() >= 3;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public Object performCommand(List<String> param) throws MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String targetName = param.get(0);
-		String compilerName = param.get(1);
-		String cpuTransp = param.get(2);
-
-		// remaining arguments are flags
-		String pattern = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_INIT_COMMAND);
-
-		ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
-		substitutor.define("TARGET", targetName);
-		substitutor.define("COMPILER", compilerName);
-
-		String options = "";
-		if (cpuTransp != null && cpuTransp.length() > 0) {
-			options += "-c " + cpuTransp;
-		}
-		substitutor.define("OPTIONS", options);
-
-		pattern = substitutor.substitute(pattern);
-
-		List<String> cmdLine = CommandLineArguments
-				.createFromCommandLine(pattern);
-
-		IProcessLauncher processLauncher = ProcessLauncherCreator
-				.createProcessLauncher(commandAbstractor
-						.getProcessLauncherFactory(), null, cmdLine);
-
-		Process process = processLauncher.createProcess();
-
-		processLauncher.redirectToConsole(true, null,
-				"Installing scratchbox2 target " + targetName);
-
-		try {
-			process.waitFor();
-		} catch (InterruptedException e) {
-			Activator.getErrorLogger().logError("Target installation aborted",
-					e);
-		}
-
-		sdk.refresh();
-
-		return true;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 3;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetCurrentTargetSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetCurrentTargetSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetCurrentTargetSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (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:
- *    Raul Herbster (UFCG) - initial API and implementation
- *    Ed Swartz (Nokia)
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.*;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.io.*;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Get the current Scratchgox 2 target. There is no command to do this, so read
- * $HOME/.scratchbox2/config
- */
-public class GetCurrentTargetSb2Command extends AbstractSb2Command {
-
-	public GetCurrentTargetSb2Command(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public String performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		IFileStore config = commandAbstractor
-				.getFileSystemAccess()
-				.getFileStore(
-						new Path("home")
-								.append(
-										commandAbstractor
-												.getPreferenceValue(CorePreferenceConstants.USER))
-								.append(".scratchbox2").append("config"));
-
-		InputStream is = null;
-		try {
-			is = config.openInputStream(EFS.NONE, null);
-			BufferedReader reader = new BufferedReader(
-					new InputStreamReader(is));
-			Pattern varPattern = Pattern
-					.compile("\\s*DEFAULT_TARGET\\s*=\\s*(\\S+)\\s*");
-			String line;
-			while ((line = reader.readLine()) != null) {
-				Matcher matcher = varPattern.matcher(line.trim());
-				if (matcher.matches()) {
-					return matcher.group(1);
-				}
-			}
-
-			return null;
-		} catch (IOException e) {
-			throw new ScratchboxException("Cannot read target from " + config
-					+ ": " + e.getMessage());
-		} catch (CoreException e) {
-			throw new ScratchboxException("Cannot read target from " + config
-					+ ": " + e.getMessage());
-		} finally {
-			Policy.close(is);
-		}
-
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetMaemoRootstrapLocationCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetMaemoRootstrapLocationCommand.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/GetMaemoRootstrapLocationCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author eswartz
- * 
- */
-public class GetMaemoRootstrapLocationCommand extends MaemoRootstrapSb2Command {
-
-	private IScratchboxSDKTarget sdkTarget;
-
-	public GetMaemoRootstrapLocationCommand(
-			ICommandAbstractor commandAbstractor, IScratchboxSDKTarget sdkTarget) {
-		super(commandAbstractor);
-		this.sdkTarget = sdkTarget;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return param.size() == 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.maemo.mica.internal.common.core.command.ICommand#performCommand(java.util
-	 * .List)
-	 */
-	public Object performCommand(List<String> params)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(params))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		List<String> rsCommands = new ArrayList<String>(2);
-
-		String pathAction = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_PATH_ACT);
-
-		rsCommands.add(pathAction);
-		rsCommands.add(sdkTarget.getName());
-
-		List<String> results = doPerformCommand(rsCommands, null, 0);
-		if (results.size() == 0)
-			throw new ScratchboxException(
-					"Could not detect rootstrap location for " + sdkTarget
-							+ "\ngot:\n" + catenateLines(results));
-
-		// ignore bogus report of deleted rootstrap
-		IPath root = new Path(results.get(0).trim());
-		IFileStore store = sdkTarget.getMachineFileSystemAccess().getFileStore(
-				root);
-		if (store.fetchInfo().exists())
-			return root;
-		else
-			throw new ScratchboxException("Rootstrap location for " + sdkTarget
-					+ " does not exist: " + store);
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.scratchbox.sb2.sdk.MaemoRootstrap;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
-import org.maemo.mica.common.core.process.ProcessLauncherUtils;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.*;
-
-/**
- * List the maemo rootstraps available for installation.
- */
-public class ListAvailableMaemoRootstrapsSb2Command extends
-		MaemoRootstrapSb2Command {
-
-	private static final int LIST_TIMEOUT = 10000;
-
-	public ListAvailableMaemoRootstrapsSb2Command(
-			ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return param.size() == 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public List<MaemoRootstrap> performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String availableAction = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT);
-
-		// ensure the proxy is established
-		IEnvironmentModifierBlock proxyEnvBlock = commandAbstractor
-				.getProcessLauncherFactory().defaultEnvironmentModifierBlock();
-		ProcessLauncherUtils.defineProxyVariables(proxyEnvBlock);
-
-		List<String> available = doPerformCommand(Collections
-				.singletonList(availableAction), proxyEnvBlock, LIST_TIMEOUT);
-
-		// this output has a few header lines
-		List<MaemoRootstrap> targetsAvailable = new ArrayList<MaemoRootstrap>();
-
-		boolean gotHeader = false;
-		for (String line : available) {
-			if (line.contains("Nickname,")) {
-				gotHeader = true;
-				continue;
-			}
-			if (line.trim().length() == 0) {
-				continue;
-			}
-			if (!gotHeader) {
-				continue;
-			}
-
-			String[] tokens = line.split(",\\s*");
-			if (tokens.length == 3) {
-				targetsAvailable.add(new MaemoRootstrap(tokens[0], tokens[1],
-						tokens[2]));
-			}
-
-		}
-		return targetsAvailable;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListCompilersSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListCompilersSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListCompilersSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.internal.scratchbox.sb2.Activator;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * List the installed compilers. There's no known command for this, but we can
- * look in specific places.
- * 
- */
-public class ListCompilersSb2Command extends AbstractSb2Command {
-
-	public ListCompilersSb2Command(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public List<String> performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		List<String> compilersAvailable = new ArrayList<String>();
-
-		try {
-			IFileStore baseToolDir = commandAbstractor.getFileSystemAccess()
-					.getFileStore(new Path("/opt/maemo/tools"));
-			IFileStore[] kids = baseToolDir.childStores(EFS.NONE, null);
-			for (IFileStore baseDir : kids) {
-				IFileStore dir = baseDir.getChild("bin");
-				if (dir.fetchInfo().isDirectory()) {
-					IFileStore[] files = dir.childStores(EFS.NONE, null);
-					for (IFileStore file : files) {
-						if (file.getName().endsWith("-gcc")) {
-							compilersAvailable.add(file.toURI().getPath());
-							break;
-						}
-					}
-				}
-			}
-		} catch (CoreException e) {
-			Activator.getErrorLogger().logError("Error scanning compilers", e);
-		}
-		return compilersAvailable;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * List the maemo rootstraps installed
- */
-public class ListInstalledMaemoRootstrapsSb2Command extends
-		MaemoRootstrapSb2Command {
-
-	public ListInstalledMaemoRootstrapsSb2Command(
-			ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return param.size() == 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public List<String> performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String availableAction = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_LIST_ACT);
-
-		List<String> installed = doPerformCommand(Collections
-				.singletonList(availableAction), null, 0);
-
-		return installed;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListTargetsCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListTargetsCommand.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListTargetsCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (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:
- *    Raul Herbster (UFCG) - initial API and implementation
- *    Ed Swartz (Nokia)
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.List;
-
-/**
- * List the installed targets. This command wraps the callback to service (sb1)
- * sb-conf list --targets or sb2-config -l (sb2)
- * 
- */
-public class ListTargetsCommand extends AbstractSb2Command {
-
-	public ListTargetsCommand(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public List<String> performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String listAction;
-		String targetsOption;
-		listAction = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_LIST_ACT);
-		targetsOption = "";
-
-		String listTargetsCommandString = this.replaceScratchboxConfigCommand(
-				listAction, new String[] { targetsOption });
-
-		Process process = createProcess(listTargetsCommandString, null);
-
-		List<String> targetsAvailable = getLineInputFromProcessAndWait(process,
-				true, 0);
-
-		return targetsAvailable;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapCommand.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,14 +1,31 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.command;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
 import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
 
 public class MaemoRootstrapCommand extends AbstractSb2Command {
 	
+	public static final int INSTALLED_TARGETS = 0;
+	public static final int AVAILABLE_TARGETS = 1;
 	
-	
 	private static final String MAEMO_ROOTSTRAP = "maemo-rootstrap";
 	
 	private static final String COMMAND_INSTALL = "install";
@@ -16,10 +33,18 @@
 	private static final String COMMAND_AVAILABLE = "available";
 
 	private static final String PATH = "path";
+	private static final String ARCH = "arch";
+
+	private static final String COMMAND_REMOVE = "remove";
+
+	private static final String OPTION_FORCE = "--force";
+
+	private static final String COMMAND_NEW = "new";
 	
+	
 
-	public MaemoRootstrapCommand(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
+	public MaemoRootstrapCommand(ICommandAbstractor commandAbstractor, IProcessLauncherFactory launcherFactory) {
+		super(commandAbstractor,launcherFactory);
 	}
 
 	@Override
@@ -35,45 +60,66 @@
 	
 	/**
 	 * maemo-rootstrap install rootstrap
+	 * @param monitor 
 	 */
-	public void performInstallRootstrap(String rootstrapName) throws MicaException{
-		createProcess(createCLI(MAEMO_ROOTSTRAP,COMMAND_INSTALL,rootstrapName));
+	public void install(String rootstrapName, IProgressMonitor monitor) throws MicaException{
+		runProcess(monitor,MAEMO_ROOTSTRAP,COMMAND_INSTALL,rootstrapName);
 	}
 
 	/**
 	 * run maemo-rootstrap list
 	 * @return
 	 */
-	public List<String> performListInstalledRootstraps() throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_ROOTSTRAP,COMMAND_LIST));
-		return getLineInputFromProcessAndWait(process, false);
+	public List<String> list(int type) throws MicaException{
+		Results result = null;
+		switch(type){
+		case INSTALLED_TARGETS:
+			result = runProcess(MAEMO_ROOTSTRAP,COMMAND_LIST);
+			break;
+		case AVAILABLE_TARGETS:
+			result = runProcess(MAEMO_ROOTSTRAP,COMMAND_AVAILABLE);
+			break;
+		}
+		if(result!=null)
+			return Arrays.asList(result.getStdoutLines());
+		else
+			return new ArrayList<String>();
 	}
 	
 	/**
-	 * run maemo-rootstrap available
+	 * sudo maemo-rootstrap remove <rootstrapName>
 	 * @return
+	 * @throws MicaException
 	 */
-	public List<String> performListAvailableRooList() throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_ROOTSTRAP,COMMAND_AVAILABLE));
-		return getLineInputFromProcessAndWait(process, false);
+	public void remove(String name) throws MicaException{
+		runProcess(MAEMO_ROOTSTRAP,OPTION_FORCE,COMMAND_REMOVE,name);
 	}
 	
 	/**
-	 * sudo maemo-rootstrap remove <rootstrapName>
+	 * run maemo-rootstrap path <name>
 	 * @param name
 	 */
-	public void performRemoveRootstrap(String name){
-		
+	public String showLocation(String name) throws MicaException{
+		Results result = runProcess(MAEMO_ROOTSTRAP,PATH,name);
+		return result.stdout;
 	}
-	
+
 	/**
-	 * run maemo-rootstrap path <name>
-	 * @param name
+	 * run maemo-rootstrap arch <name>
+	 * @param rootstrap name, e.g. diablo41_armel
+	 * @return architecture name
+	 * @throws MicaException - when unknown architecture 
 	 */
-	public String performRootstrapLocation(String name) throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_ROOTSTRAP,PATH,name));
-		return getInputFromProcessAndWait(process, false);
+	public String showArchitecture(String name) throws MicaException{
+		Results result = runProcess(MAEMO_ROOTSTRAP,ARCH,name);
+		return result.stdout.replaceAll("\n", "");
 	}
 
+	public boolean newRootstrap(String name) throws MicaException {
+		Results result =  runProcess(MAEMO_ROOTSTRAP,COMMAND_NEW,name);
+		return result.exitCode==0;
+		
+	}
+
 	
 }

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoRootstrapSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
-import org.maemo.mica.common.core.process.CommandLineArguments;
-import org.maemo.mica.common.core.process.ShellTemplateSubstitutor;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Base class for maemo rootstrap command.
- */
-public abstract class MaemoRootstrapSb2Command extends AbstractSb2Command {
-
-	public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return true;
-	}
-
-	/**
-	 * Override if stderr output is allowed.
-	 * 
-	 * @return false
-	 */
-	protected boolean allowErrors() {
-		return false;
-
-	}
-
-	/**
-	 * Perform the command with the given params as command line arguments, with
-	 * an optional timeout (triggering ScratchboxException if reached)
-	 * 
-	 * @param params
-	 *            command line parameters to maemo-rootstrap
-	 * @param envBlock
-	 *            any environment needed or <code>null</code>
-	 * @param timeout
-	 *            if not 0, timeout in milliseconds
-	 * @return lines from stdout
-	 * @throws ScratchboxException
-	 *             if command execution fails or if timeout reached
-	 */
-	@SuppressWarnings("unchecked")
-	protected List<String> doPerformCommand(List<String> params,
-			IEnvironmentModifierBlock envBlock, long timeout)
-			throws MicaException {
-		String rootstrapCommand = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_COMMAND);
-
-		String options = CommandLineArguments.toCommandLine(params);
-
-		ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
-		substitutor.define("OPTIONS", options);
-
-		rootstrapCommand = substitutor.substitute(rootstrapCommand);
-
-		if (console == null) {
-			Process process = createProcess(rootstrapCommand, envBlock);
-			List<String> results = getLineInputFromProcessAndWait(process,
-					allowErrors(), timeout);
-			return results;
-		} else {
-			runAndWaitForProcess("Running " + rootstrapCommand,
-					rootstrapCommand, envBlock, timeout);
-			return Collections.EMPTY_LIST;
-		}
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,9 +1,22 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.command;
 
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
+import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
 import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
 import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
 
 public class MaemoSdkCommand extends AbstractSb2Command{
@@ -21,14 +34,13 @@
 	private static final String COMMAND_LIST = "list";
 	private static final String SPECIFIER_TOOLCHAINS = "toolchains";
 
-	public MaemoSdkCommand(ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
+	public MaemoSdkCommand(ICommandAbstractor commandAbstractor, IProcessLauncherFactory launcherFactory) {
+		super(commandAbstractor,launcherFactory);
 		// TODO Auto-generated constructor stub
 	}
 
 	@Override
 	public int getParametersSize() {
-		// TODO Auto-generated method stub
 		return 0;
 	}
 
@@ -41,16 +53,16 @@
 	 * @param targetName
 	 * @throws MicaException
 	 */
-	public void performStartGui(String targetName) throws MicaException{
-		createProcess(createCLI(MAEMO_SDK,COMMAND_START,SPECIFIER_GUI,targetName));
+	public void startMaemo(String targetName) throws MicaException{
+		runProcess(MAEMO_SDK,COMMAND_START,SPECIFIER_GUI,targetName);
 	}
 
 	/**
 	 * @param targetName
 	 * @throws MicaException
 	 */
-	public void performStopMaemo(String targetName) throws MicaException{
-		createProcess(createCLI(MAEMO_SDK,COMMAND_STOP,SPECIFIER_GUI,targetName));
+	public void stopMaemo(String targetName) throws MicaException{
+		runProcess(MAEMO_SDK,COMMAND_STOP,SPECIFIER_GUI,targetName);
 	}
 
 	/**
@@ -58,9 +70,9 @@
 	 * @return
 	 * @throws MicaException
 	 */
-	public String performStatus(String targetName) throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_SDK,COMMAND_SHOW,SPECIFIER_GUI,targetName));
-		return getInputFromProcessAndWait(process, false).toLowerCase();
+	public boolean isUp(String targetName) throws MicaException{
+		Results result = runProcess(MAEMO_SDK,COMMAND_SHOW,SPECIFIER_GUI,targetName);
+		return result.stdout.equals(STATUS_UP);
 	}
 	
 	/**
@@ -68,9 +80,9 @@
 	 * @return
 	 * @throws MicaException
 	 */
-	public String performShowDefaultRootstrap() throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_SDK,COMMAND_SHOW,SPECIFIER_ROOTSTRAP));
-		return getInputFromProcessAndWait(process, false);
+	public String getDefaultRootstrap() throws MicaException{
+		Results result = runProcess(MAEMO_SDK,COMMAND_SHOW,SPECIFIER_ROOTSTRAP);
+		return result.stdout;
 	}
 	
 	/**
@@ -78,8 +90,8 @@
 	 * @return
 	 * @throws MicaException
 	 */
-	public List<String> performListCompilers() throws MicaException{
-		Process process = createProcess(createCLI(MAEMO_SDK,COMMAND_LIST,SPECIFIER_TOOLCHAINS));
-		return getLineInputFromProcessAndWait(process, false);
+	public List<String> listCompilers() throws MicaException{
+		Results result = runProcess(MAEMO_SDK,COMMAND_LIST,SPECIFIER_TOOLCHAINS);
+		return Arrays.asList(result.getStdoutLines());
 	}
 }

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveMaemoRootstrapSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveMaemoRootstrapSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.CoreConsoleManager;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
-import org.maemo.mica.common.core.process.ProcessLauncherUtils;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Remove a maemo rootstrap. Parameters are target name and force boolean flag.
- */
-public class RemoveMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
-
-	private final IProgressMonitor monitor;
-
-	public RemoveMaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor,
-			IProgressMonitor monitor) {
-		super(commandAbstractor);
-		this.monitor = monitor;
-	}
-
-	@Override
-	protected boolean checkParameters(List<String> param) {
-		return param.size() == 2;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public Boolean performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String targetName = param.get(0);
-		String forceFlag = param.get(1);
-
-		String action = commandAbstractor
-				.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_REMOVE_ACT);
-
-		List<String> commands = new ArrayList<String>();
-
-		if (forceFlag.equals(Boolean.TRUE.toString())) {
-			String force = commandAbstractor
-					.getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT);
-			commands.add(force);
-		}
-		commands.add(action);
-		commands.add(targetName);
-
-		IEnvironmentModifierBlock envBlock = commandAbstractor
-				.getProcessLauncherFactory().defaultEnvironmentModifierBlock();
-		ProcessLauncherUtils.defineProxyVariables(envBlock);
-
-		setMonitorAndConsole(monitor, CoreConsoleManager.getInstance().getConsole(true,
-				null, "Removing rootstrap " + targetName));
-
-		doPerformCommand(commands, envBlock, 0);
-
-		return Boolean.TRUE;
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 0;
-	}
-
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveTargetSb2Command.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveTargetSb2Command.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/RemoveTargetSb2Command.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * 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
- *    Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.internal.scratchbox.sb2.command;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
-import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.sdk.ISDK;
-import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Remove a Scratchbox 2 target. There's no known command for this, but we can
- * manually fix up the system.
- * 
- */
-public class RemoveTargetSb2Command extends AbstractSb2Command {
-
-	private Scratchbox2SDK sdk;
-
-	public RemoveTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
-		super(commandAbstractor);
-		this.sdk = (Scratchbox2SDK) sdk;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
-	 * .lang.Object)
-	 */
-	public Object performCommand(List<String> param)
-			throws ScratchboxException, MicaException {
-		if (!this.checkParameters(param))
-			throw new ScratchboxInvalidParameterException(
-					"Invalid number of parameters");
-
-		String targetToRemove = param.get(0);
-		if (!targetExist(targetToRemove))
-			throw new ScratchboxInvalidParameterException("Target "
-					+ targetToRemove + " does not exist.");
-
-		IFileStore sb2Dir = commandAbstractor.getFileSystemAccess()
-				.getFileStore(sdk.getScratchbox2ConfigDirectory());
-		IFileStore targetDir = sb2Dir.getChild(targetToRemove);
-
-		if (!targetDir.fetchInfo().exists()) {
-			throw new ScratchboxInvalidParameterException("Target "
-					+ targetToRemove
-					+ " does not exist at the expected location: " + targetDir);
-		}
-
-		try {
-			targetDir.delete(EFS.NONE, null);
-		} catch (CoreException e) {
-			throw new ScratchboxException("Failed to delete rootstrap", e);
-		} finally {
-			sdk.refresh();
-		}
-
-		return true;
-	}
-
-	/**
-	 * Verify if a target exists.
-	 * 
-	 * @param targetToRemove
-	 *            the target to verify.
-	 * 
-	 * @return true, if the target exists in Scratchbox; false, otherwise.
-	 * @throws ScratchboxException
-	 *             if some problem occurrs while requesting Scratchbox services.
-	 */
-	private boolean targetExist(String targetToRemove) throws MicaException {
-		List<String> targetsAvailable = new ListTargetsCommand(
-				commandAbstractor).performCommand(new ArrayList<String>());
-		return targetsAvailable.contains(targetToRemove);
-	}
-
-	@Override
-	public int getParametersSize() {
-		return 1;
-	}
-
-}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -10,25 +10,36 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.core;
 
-import org.eclipse.core.runtime.*;
-import org.maemo.esbox.internal.api.scratchbox.core.sdk.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.internal.api.scratchbox.core.sdk.AbstractScratchboxSDK;
+import org.maemo.esbox.internal.api.scratchbox.core.sdk.CacheUtils;
 import org.maemo.esbox.internal.scratchbox.sb2.Activator;
-import org.maemo.esbox.internal.scratchbox.sb2.command.*;
+import org.maemo.esbox.internal.scratchbox.sb2.command.GetVersionScratchboxCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.command.ListCputranspSb2Command;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoRootstrapCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoSdkCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.command.ShowPathMappingSb2Command;
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
 import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDK;
-import org.maemo.esbox.scratchbox.sb2.sdk.MaemoRootstrap;
-import org.maemo.mica.common.core.CorePreferenceConstants;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.IMachine;
 import org.maemo.mica.common.core.machine.MachineUtils;
-import org.maemo.mica.common.core.sdk.*;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.sdk.IPreferenceProvider;
+import org.maemo.mica.common.core.sdk.ISDKPlatform;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
 import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
 import org.maemo.mica.internal.api.common.core.sdk.BaseSDKPlatform;
 
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 /**
  * @author baranov
  * 
@@ -38,18 +49,46 @@
 
 	private static final IPath ROOT_PATH = new Path("/");
 	private static Pattern TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN = Pattern
-			.compile("([a-zA-Z_]+)(\\d+)_([a-zA-Z]+)");
+			.compile("([a-zA-Z_]+)(\\d+)_([a-zA-Z\\d]+)");
 
 	private static final String SB2_MACHINE = "sb2_machine";
 	private static final String SB2_VERSION = "sb2_version";
 
+	private MaemoSdkCommand maemoSdkCommand;
+	
+
+
+	private MaemoRootstrapCommand maemoRootstrapCommand;
+	
 	public Scratchbox2SDK(IMachine machine, String version,
 			IPreferenceProvider prefProvider) {
 		super(machine, version, "Scratchbox 2", SB2_MACHINE, SB2_VERSION,
 				"sb2_targets", 2);
 		this.prefProvider = prefProvider;
+		
+		createCommands();
 	}
 
+
+
+	private void createCommands() {
+		ICommandAbstractor commandAbstractor = null;
+		IProcessLauncherFactory launcherFactory = this.getMachineProcessLauncherFactory();
+		try{
+			commandAbstractor = getCommandAbstractor();
+		}catch(MicaException e){
+			//TODO: confirm that MicaException is needed.
+		}
+		if(commandAbstractor != null && launcherFactory != null){
+			maemoSdkCommand = new MaemoSdkCommand(commandAbstractor,launcherFactory);
+			maemoRootstrapCommand = new MaemoRootstrapCommand(commandAbstractor,launcherFactory);
+		}
+	}
+
+	public MaemoSdkCommand getMaemoSdkCommand() {
+		return maemoSdkCommand;
+	}
+	
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -64,51 +103,45 @@
 			Activator.getErrorLogger().logError("Could not refresh targets", e);
 			return;
 		}
+		
 		List<ISDKTarget> newTargets = new ArrayList<ISDKTarget>();
 		for (String target : targetNames) {
 			// ignore this one, left behind by errant rootstrap installations
 			if (target.equals("libtool_build"))
 				continue;
-			IPath config = getScratchbox2ConfigDirectory();
-			IPath sb2BasePath = config.append(target);
+			
+			IPath rootstrapLocation = null;
+			try{
+				rootstrapLocation = new Path(maemoRootstrapCommand.showLocation(target));
+			}catch(MicaException e){
+				//TODO: handle exception
+			}
 			Scratchbox2SDKTarget sdkTarget = new Scratchbox2SDKTarget(this,
 					getPlatform(target), getArchitecture(target), target,
-					sb2BasePath);
+					rootstrapLocation);
+			
 			newTargets.add(sdkTarget);
-
-			try {
-				IPath sb2RootstrapPath = getMaemoRootstrapPath(sdkTarget);
-				sdkTarget.setRootstrapPath(sb2RootstrapPath);
-			} catch (MicaException e) {
-				Activator.getErrorLogger().logError(null, e);
-			}
-
 		}
 		this.targets = newTargets;
 	}
 
+	
+	
+	@Override
+	public int installRootstrap(String rootstrap, IProgressMonitor monitor) throws MicaException {
+		maemoRootstrapCommand.install(rootstrap,monitor);
+		return 0;
+	}
+
+
+
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#getTargets()
 	 */
 	public List<String> getTargets() throws MicaException {
-		CacheUtils.getInstance().ensureCurrentMachine(SB_MACHINE, this.getMachine());
-
-		String[] targetsArray = (String[]) CacheUtils.getInstance()
-				.getCachedValue(SB_TARGETS);
-		if (targetsArray != null)
-			return Arrays.asList(targetsArray);
-
-		ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
-				getCommandAbstractor());
-		List<String> targets = listTargetsCommand
-				.performCommand(new ArrayList<String>());
-
-		CacheUtils.getInstance().setCachedValue(SB_TARGETS,
-				(String[]) targets.toArray(new String[targets.size()]));
-
-		return targets;
+		return maemoRootstrapCommand.list(MaemoRootstrapCommand.INSTALLED_TARGETS);
 	}
 
 	/*
@@ -126,38 +159,13 @@
 	/*
 	 * (non-Javadoc)
 	 * 
-	 * @seeorg.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK#
-	 * getScratchbox2ConfigDirectory()
-	 */
-	public IPath getScratchbox2ConfigDirectory() {
-		String userName = prefProvider
-				.getPreferenceValue(CorePreferenceConstants.USER);
-		if (userName.length() == 0)
-			userName = "ubuntu";
-		return new Path("home").append(userName).append(".scratchbox2")
-				.makeAbsolute();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
 	 * @see
 	 * org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#createTarget(java.lang
 	 * .String, java.lang.String, java.lang.String, java.lang.String)
 	 */
 	public boolean createTarget(String targetName, String compiler,
 			String devkits, String cputransp) throws MicaException {
-		List<String> params = new ArrayList<String>();
-		params.add(targetName);
-		params.add(compiler);
-		params.add(cputransp);
-
-		CreateTargetSb2Command createTargetCommand = new CreateTargetSb2Command(
-				this, getCommandAbstractor());
-
-		CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
-
-		return (Boolean) createTargetCommand.performCommand(params);
+		return maemoRootstrapCommand.newRootstrap(targetName);
 	}
 
 	/*
@@ -166,9 +174,7 @@
 	 * @see org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#getCompilers()
 	 */
 	public List<String> getCompilers() throws MicaException {
-		ListCompilersSb2Command listCompilersCommand = new ListCompilersSb2Command(
-				getCommandAbstractor());
-		return listCompilersCommand.performCommand(EMPTY_ARGS);
+		return maemoSdkCommand.listCompilers();
 	}
 
 	/*
@@ -188,10 +194,7 @@
 	 * @see org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#getCurrentTarget()
 	 */
 	public String getCurrentTarget() throws MicaException {
-		GetCurrentTargetSb2Command getCurrentTargetCommand = new GetCurrentTargetSb2Command(
-				getCommandAbstractor());
-		return (String) getCurrentTargetCommand
-				.performCommand(new ArrayList<String>());
+		return maemoSdkCommand.getDefaultRootstrap();
 	}
 
 	/*
@@ -202,18 +205,8 @@
 	 * .String)
 	 */
 	public boolean removeTarget(String targetName) throws MicaException {
-		List<String> params = new ArrayList<String>();
-		params.add(targetName);
-
-		RemoveTargetSb2Command removeTargetCommand;
-		removeTargetCommand = new RemoveTargetSb2Command(this,
-				getCommandAbstractor());
-		CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
-		CacheUtils.getInstance().setCachedValue(
-				SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
-		CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
-				null);
-		return (Boolean) removeTargetCommand.performCommand(params);
+		maemoRootstrapCommand.remove(targetName);
+		return true;
 	}
 
 	/*
@@ -225,22 +218,21 @@
 		return ROOT_PATH;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @seeorg.maemo.esbox.internal.maemosdk.core.sdk.
-	 * IScratchboxSDKPlatformArchitectureProvider
-	 * #getArchitecture(java.lang.String)
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.internal.api.scratchbox.core.sdk.IScratchboxSDKPlatformArchitectureProvider#getArchitecture(java.lang.String)
 	 */
 	public String getArchitecture(String target) {
-		// convention says this is the part of the target after the underscore
-		Matcher matcher = TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN
-				.matcher(target);
-		if (matcher.matches()) {
-			return matcher.group(3).toUpperCase();
-		} else {
-			return IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
+		String arch;
+		try{
+			arch = maemoRootstrapCommand.showArchitecture(target).toUpperCase();
+		}catch(MicaException e){
+			arch="";
 		}
+		if(arch.equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)
+				||arch.equals(IScratchboxSDKTarget.ARCHITECTURE_X86))
+			return arch;
+		else
+			return IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
 	}
 
 	public ISDKPlatform getPlatform(String target) {
@@ -275,9 +267,7 @@
 	 */
 	public synchronized List<String> getInstalledMaemoRootstraps()
 			throws MicaException {
-		ListInstalledMaemoRootstrapsSb2Command command = new ListInstalledMaemoRootstrapsSb2Command(
-				MachineUtils.getHostCommandAbstractor(this.getMachine()));
-		return command.performCommand(EMPTY_ARGS);
+		return maemoRootstrapCommand.list(MaemoRootstrapCommand.INSTALLED_TARGETS);
 	}
 
 	/*
@@ -287,11 +277,9 @@
 	 * org.maemo.mica.maemosdk.sb2.core.IScratchbox2SDK#getAvailableMaemoRootstraps
 	 * (org.maemo.mica.common.core.machine.IMachine)
 	 */
-	public List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine)
+	public List<String> getAvailableMaemoRootstraps()
 			throws MicaException {
-		ListAvailableMaemoRootstrapsSb2Command command = new ListAvailableMaemoRootstrapsSb2Command(
-				MachineUtils.getHostCommandAbstractor(machine));
-		return command.performCommand(EMPTY_ARGS);
+		return maemoRootstrapCommand.list(MaemoRootstrapCommand.AVAILABLE_TARGETS);
 	}
 
 	/*
@@ -305,17 +293,7 @@
 	public boolean createRootstrapTarget(String targetName,
 			boolean useHostTools, boolean force, IProgressMonitor monitor)
 			throws MicaException {
-		List<String> params = new ArrayList<String>();
-		params.add(targetName);
-		params.add(Boolean.toString(useHostTools));
-		params.add(Boolean.toString(force));
-
-		CreateMaemoRootstrapSb2Command createTargetCommand = new CreateMaemoRootstrapSb2Command(
-				this, getCommandAbstractor(), monitor);
-
-		CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
-
-		return createTargetCommand.performCommand(params);
+		return maemoRootstrapCommand.newRootstrap(targetName);
 	}
 
 	/*
@@ -325,22 +303,9 @@
 	 * org.maemo.mica.maemosdk.sb2.core.IScratchbox2SDK#removeRootstrap(java
 	 * .lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor)
 	 */
-	public boolean removeRootstrap(String targetName, boolean force,
+	public void removeRootstrap(String targetName, boolean force,
 			IProgressMonitor monitor) throws MicaException {
-		List<String> params = new ArrayList<String>();
-		params.add(targetName);
-		params.add(Boolean.toString(force));
-
-		RemoveMaemoRootstrapSb2Command removeTargetCommand = new RemoveMaemoRootstrapSb2Command(
-				getCommandAbstractor(), monitor);
-
-		CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
-		CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
-				null);
-		CacheUtils.getInstance().setCachedValue(
-				SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
-
-		return removeTargetCommand.performCommand(params);
+		maemoRootstrapCommand.remove(targetName);
 	}
 
 	/**
@@ -453,58 +418,7 @@
 		return currentVersion;
 	}
 
-	/**
-	 * Get the path where a maemo rootstrap is installed
-	 * 
-	 * @param scratchbox2SDKTarget
-	 * @return path of rootstrap
-	 * @throws MicaException
-	 *             if not located
-	 */
-	private synchronized IPath getMaemoRootstrapPath(
-			Scratchbox2SDKTarget sdkTarget) throws MicaException {
-		// find cached value
-		CacheUtils.getInstance().ensureCurrentMachine(SB_MACHINE, sdkTarget.getSDK()
-				.getMachine());
-		Map<String, String> targetToRootstrapMap = null;
-		targetToRootstrapMap = (Map<String, String>) CacheUtils.getInstance()
-				.getCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP);
-		if (targetToRootstrapMap != null) {
-			String rootstrap = targetToRootstrapMap.get(sdkTarget.getName());
-			if (rootstrap != null) {
-				return new Path(rootstrap);
-			}
-		}
 
-		// do the hard work
-		GetMaemoRootstrapLocationCommand command = new GetMaemoRootstrapLocationCommand(
-				getCommandAbstractor(), sdkTarget);
-		IPath rootstrapPath;
-
-		// be sure to record something in the cache for broken targets so
-		// we don't keep asking all the time
-		MicaException caughtException = null;
-		try {
-			rootstrapPath = (IPath) command.performCommand(EMPTY_ARGS);
-		} catch (MicaException e) {
-			rootstrapPath = Path.EMPTY;
-			caughtException = e;
-		}
-
-		// store cached value
-		if (targetToRootstrapMap == null)
-			targetToRootstrapMap = new HashMap<String, String>();
-		targetToRootstrapMap.put(sdkTarget.getName(), rootstrapPath
-				.toPortableString());
-		CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
-				targetToRootstrapMap);
-
-		if (caughtException != null)
-			throw caughtException;
-
-		return rootstrapPath;
-	}
-
 	/**
 	 * Get a command abstractor that updates the PATH if sb2 tools are not on
 	 * the path.

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.sb2.launcher;
+
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoSdkCommand;
+import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
+import org.maemo.mica.common.core.MicaException;
+
+public class Sb2MaemoLauncherAdapter implements IMaemoLauncherAdapter {
+	private final IScratchbox2SDKTarget target;
+	private MaemoSdkCommand command;
+	
+	public Sb2MaemoLauncherAdapter(IScratchbox2SDKTarget adaptableObject) {
+		target = adaptableObject;
+		command = ((Scratchbox2SDK)target.getSDK()).getMaemoSdkCommand();
+	}
+
+	@Override
+	public boolean isMaemoRunning() throws MicaException {
+		return command.isUp(target.getName());
+	}
+
+	@Override
+	public void killMaemo() throws MicaException {
+		stopMaemo();
+	}
+	
+	@Override
+	public void restartMaemo() throws MicaException {
+		startMaemo();
+	}
+
+	@Override
+	public void startMaemo() throws MicaException {
+		command.startMaemo(target.getName());
+	}
+
+	@Override
+	public void stopMaemo() throws MicaException {
+		command.stopMaemo(target.getName());
+	}
+}

Added: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapterFactory.java	                        (rev 0)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -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:
+ *    Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.scratchbox.sb2.launcher;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
+
+public class Sb2MaemoLauncherAdapterFactory implements IAdapterFactory {
+
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if (adapterType.equals(IMaemoLauncherAdapter.class)) {
+			if (adaptableObject instanceof IScratchbox2SDKTarget) {
+				return new Sb2MaemoLauncherAdapter((IScratchbox2SDKTarget)adaptableObject);
+			}
+		}
+		return null;
+	}
+
+	@Override
+	public Class[] getAdapterList() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -94,12 +94,6 @@
 		return commandArgs;
 	}
 
-	@Override
-	protected void setupForLaunch() throws MicaException {
-		// nothing
-		super.setupForLaunch();
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * 

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -98,11 +98,9 @@
 			try {
 				// see if a rootstrap -- possibly disconnected from the target --
 				// exists
-				List<MaemoRootstrap> rootstraps = sdk
-						.getAvailableMaemoRootstraps(selectedTarget.getSDK()
-								.getMachine());
-				for (MaemoRootstrap rootstrap : rootstraps) {
-					if (rootstrap.getName().equals(selectedTarget.getName())) {
+				List<String> rootstraps = sdk.getAvailableMaemoRootstraps();
+				for (String rootstrap : rootstraps) {
+					if (rootstrap.equals(selectedTarget.getName())) {
 						rootstrapUsed_ = true;
 						break;
 					}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapter.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapter.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,45 +0,0 @@
-package org.maemo.esbox.internal.scratchbox.sb2.ui.adapters;
-
-import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.internal.api.scratchbox.core.sdk.AbstractScratchboxSDK;
-import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoSdkCommand;
-import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
-import org.maemo.mica.common.core.MicaException;
-
-public class Sb2MaemoLauncherAdapter implements IMaemoLauncherAdapter {
-	private final IScratchbox2SDKTarget target;
-	private MaemoSdkCommand command;
-	
-	public Sb2MaemoLauncherAdapter(IScratchbox2SDKTarget adaptableObject) {
-		target = adaptableObject;
-		try{
-			command = new MaemoSdkCommand(((AbstractScratchboxSDK)target.getSDK()).getCommandAbstractor());
-		}catch(MicaException e){
-		}
-	}
-
-	@Override
-	public boolean isMaemoRunning() throws MicaException {
-		return command.performStatus(target.getName()).equals(MaemoSdkCommand.STATUS_UP);
-	}
-
-	@Override
-	public void killMaemo() throws MicaException {
-		stopMaemo();
-	}
-	
-	@Override
-	public void restartMaemo() throws MicaException {
-		startMaemo();
-	}
-
-	@Override
-	public void startMaemo() throws MicaException {
-		command.performStartGui(target.getName());
-	}
-
-	@Override
-	public void stopMaemo() throws MicaException {
-		command.performStopMaemo(target.getName());
-	}
-}

Deleted: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapterFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapterFactory.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/Sb2MaemoLauncherAdapterFactory.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -1,25 +0,0 @@
-package org.maemo.esbox.internal.scratchbox.sb2.ui.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
-
-public class Sb2MaemoLauncherAdapterFactory implements IAdapterFactory {
-
-	@Override
-	public Object getAdapter(Object adaptableObject, Class adapterType) {
-		if (adapterType.equals(IMaemoLauncherAdapter.class)) {
-			if (adaptableObject instanceof IScratchbox2SDKTarget) {
-				return new Sb2MaemoLauncherAdapter((IScratchbox2SDKTarget)adaptableObject);
-			}
-		}
-		return null;
-	}
-
-	@Override
-	public Class[] getAdapterList() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -12,19 +12,24 @@
 
 package org.maemo.esbox.internal.scratchbox.sb2.ui.wizard;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
 import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDK;
-import org.maemo.esbox.scratchbox.sb2.sdk.MaemoRootstrap;
 import org.maemo.mica.common.core.MicaException;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * This class provides installable rootstraps, descriptions, etc. from the
  * result of 'maemo-rootstrap'.
@@ -39,8 +44,8 @@
 	static final int COLUMN_ARCHITECTURE = 1;
 	static final int COLUMN_DESCRIPTION = 2;
 
-	public static Object NO_ROOTSTRAP = new Object();
-	public static Object LOADING_LABEL = new Object();
+//	public static Object NO_ROOTSTRAP = new Object();
+//	public static Object LOADING_LABEL = new Object();
 
 	private boolean rootstrapsFetched;
 	// either MaemoRootstrap or NO_ROOTSTRAP
@@ -55,19 +60,15 @@
 	public Object[] getElements(Object inputElement) {
 		if (!rootstrapsFetched) {
 			rootstraps = new ArrayList<Object>();
-			rootstraps.add(NO_ROOTSTRAP);
-			rootstraps.add(LOADING_LABEL);
 
 			if (rootstrapThread == null) {
 				rootstrapThread = new Thread(new Runnable() {
 
 					public void run() {
 						try {
-							List<MaemoRootstrap> realRootstraps = sdk
-									.getAvailableMaemoRootstraps(sdk
-											.getMachine());
+							List<String> realRootstraps = sdk.getAvailableMaemoRootstraps();
 							synchronized (rootstraps) {
-								rootstraps.remove(1);
+//								rootstraps.remove(1);
 								rootstraps.addAll(realRootstraps);
 							}
 						} catch (final MicaException e) {
@@ -130,28 +131,13 @@
 	public String getColumnText(Object element, int columnIndex) {
 		switch (columnIndex) {
 		case COLUMN_NAME:
-			if (element == NO_ROOTSTRAP) {
-				return "Custom target";
-			} else if (element == LOADING_LABEL) {
-				return "Loading...";
-			} else {
-				return ((MaemoRootstrap) element).getName();
-			}
+			return (String) element;
 
 		case COLUMN_ARCHITECTURE:
-			if (element == NO_ROOTSTRAP || element == LOADING_LABEL) {
-				return null;
-			}
-			return ((MaemoRootstrap) element).getArchitecture();
+			return sdk.getArchitecture((String)element);
 
 		case COLUMN_DESCRIPTION:
-			if (element == NO_ROOTSTRAP) {
-				return "User-defined name and compiler, manually installed rootstrap";
-			} else if (element == LOADING_LABEL) {
-				return null;
-			} else {
-				return ((MaemoRootstrap) element).getDescription();
-			}
+			return "";
 		}
 		return null;
 	}
@@ -161,18 +147,11 @@
 	}
 
 	public Color getForeground(Object element) {
-		if (element == LOADING_LABEL)
-			return Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
-		else
-			return null;
+		return null;
 	}
 
 	public Font getFont(Object element) {
-		if (element == LOADING_LABEL)
-			return JFaceResources.getFontRegistry().getItalic(
-					JFaceResources.DIALOG_FONT);
-		else
-			return null;
+		return null;
 	}
 
 }

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -13,33 +13,26 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.ui.wizard;
 
+import java.lang.reflect.InvocationTargetException;
+
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.*;
-import org.maemo.esbox.internal.api.scratchbox.ui.wizards.*;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.maemo.esbox.internal.api.scratchbox.ui.wizards.TargetWizardPageFactory;
 import org.maemo.esbox.internal.scratchbox.sb2.Activator;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
 import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDK;
-import org.maemo.esbox.scratchbox.sb2.sdk.MaemoRootstrap;
-import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.ErrorLogger;
+import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
-import org.maemo.mica.internal.api.maemosdk.ui.wizards.sbrsh.SbrshConfigurationNFSServer;
-import org.maemo.mica.internal.api.maemosdk.ui.wizards.sbrsh.SbrshConfigurationTargetDevice;
 
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.text.MessageFormat;
-import java.util.List;
-
 /**
  * The target wizard provides a easy way to create a target for Scratchbox. As
  * Scratchbox target configuration, the user can configure your target.
@@ -47,11 +40,6 @@
  */
 public class NewScratchbox2TargetWizard extends Wizard implements INewWizard {
 
-	protected WizardPage targetNamePage;
-	protected WizardPage compilerNamePage;
-	protected WizardPage cpuMethodName;
-	protected WizardPage sbrshConfigTargetDevice;
-	protected WizardPage sbrshConfigNFSServer;
 	protected IProject generatedProject;
 
 	private IScratchbox2SDK sdk;
@@ -88,21 +76,6 @@
 		if (sdk != null) {
 			maemoRootstrapPage = new TargetWizardRootstrapSb2Page(sdk);
 			addPage(maemoRootstrapPage);
-			targetNamePage = TargetWizardPageFactory.getInstance()
-					.createNamePage(sdk);
-			addPage(targetNamePage);
-			compilerNamePage = TargetWizardPageFactory.getInstance()
-					.createCompilerPage(sdk);
-			addPage(compilerNamePage);
-			cpuMethodName = TargetWizardPageFactory.getInstance()
-					.createCPUMethod(sdk);
-			addPage(cpuMethodName);
-			sbrshConfigTargetDevice = TargetWizardPageFactory.getInstance()
-					.createSbrshConfigDeviceTargetPage();
-			addPage(sbrshConfigTargetDevice);
-			sbrshConfigNFSServer = TargetWizardPageFactory.getInstance()
-					.createSbrshConfigNFSSServer();
-			addPage(sbrshConfigNFSServer);
 		} else {
 			addPage(TargetWizardPageFactory.getInstance()
 					.createBadInstallationPage());
@@ -110,150 +83,25 @@
 	}
 
 	public boolean canFinish() {
-		if (sdk == null)
-			return false;
-
-		boolean nonCustomRootstrap = true;
-		if (maemoRootstrapPage != null)
-			nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
-					.canFinish();
-		boolean cpuPage = ((TargetWizardCPUMethod) cpuMethodName).canFinish();
-		boolean configDevice = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
-				.canFinish();
-		boolean NFSServer = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
-				.canFinish();
-		boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
-				.getSbrshConfigure();
-
-		if (!sbrshConfigAccepted && (nonCustomRootstrap || cpuPage))
-			return true;
-		if (sbrshConfigAccepted && NFSServer && configDevice)
-			return true;
-
-		return false;
+		return true;
 	}
 
-	@Override
-	public IWizardPage getNextPage(IWizardPage page) {
-		if (page == maemoRootstrapPage) {
-			boolean nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
-					.canFinish();
-			if (nonCustomRootstrap)
-				return null;
-			else
-				return super.getNextPage(page);
-		}
-		if (page == cpuMethodName) {
-			boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
-					.getSbrshConfigure();
-			if (!sbrshConfigAccepted) // user does not want to configure sbrsh
-				return null;
-			else
-				// user wants to configure sbrsh
-				return super.getNextPage(page);
-		}
-		return super.getNextPage(page);
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see org.eclipse.jface.wizard.IWizard#performFinish()
 	 */
 	public boolean performFinish() {
-		if (getRootstrap() != null) {
-			if (!setupTargetFromRootstrap())
-				return false;
-		} else {
-			if (!setupTargetFromScratch())
-				return false;
-		}
-
-		boolean sbrshConfigSelected = ((TargetWizardCPUMethod) cpuMethodName)
-				.getSbrshConfigure();
-		if (sbrshConfigSelected) {
-			configureSbrshService();
-			showsDialog();
-		}
-
-		return true;
-	}
-
-	private boolean setupTargetFromScratch() {
-		String targetName;
-		// in this mode, construct a target from the user's settings
-		targetName = getTargetNameSelected();
-		String compilerName = getCompilerNameSelected();
-		String cpuMethod = getCputranspSelected();
+		final String rootstrap = getRootstrap();
 		try {
-			sdk.createTarget(targetName, compilerName, null, cpuMethod);
-			createdTarget = sdk.findSDKTarget(targetName);
-			return true;
-		} catch (MicaException e) {
-			ErrorLogger errorLogger = Activator.getErrorLogger();
-			errorLogger.logAndShowError("Cannot get create target "
-					+ targetName, e);
-			return false;
-		}
-	}
-
-	private boolean setupTargetFromRootstrap() {
-		String targetName;
-		// in this mode, make a predefined target from a maemo rootstrap
-		targetName = getRootstrap().getName();
-		boolean create = true;
-
-		if (true) {
-			// see if the rootstrap (not necessarily the target) already exists,
-			// and ask user, in case this will overwrite their customizations
-			try {
-				List<String> installedRootstraps = sdk
-						.getInstalledMaemoRootstraps();
-				if (installedRootstraps.contains(targetName)) {
-					create = MessageDialog
-							.openConfirm(
-									getShell(),
-									"Reinstall rootstrap?",
-									MessageFormat
-											.format(
-													"The rootstrap ''{0}'' appears to be already installed, though it may be disconnected from scratchbox.\n\n"
-															+ "At this time, we can't recreate a target for this rootstrap, but "
-															+ "you could do it manually with 'sb2-init'.\n\n"
-															+ "Do you want to overwrite the rootstrap?",
-													targetName));
-				}
-			} catch (MicaException e) {
-				ErrorLogger errorLogger = Activator.getErrorLogger();
-				errorLogger.logError("Cannot detect installed rootstraps", e);
-			}
-		}
-
-		if (create) {
-			try {
-				createRootstrap(targetName, useHostTools());
-			} catch (MicaException e) {
-				ErrorLogger errorLogger = Activator.getErrorLogger();
-				errorLogger.logAndShowError(
-						"Cannot get create rootstrap target " + targetName, e);
-				return false;
-			}
-		}
-		return true;
-	}
-
-	private void createRootstrap(final String targetName,
-			final boolean useHostTools) throws ScratchboxException {
-		try {
 			getContainer().run(true, true, new IRunnableWithProgress() {
 
 				public void run(IProgressMonitor monitor)
 						throws InvocationTargetException, InterruptedException {
-					monitor.beginTask("Creating rootstrap",
+					monitor.beginTask("Installing rootstrap",
 							IProgressMonitor.UNKNOWN);
 					try {
-						sdk.createRootstrapTarget(targetName, useHostTools,
-								true, new SubProgressMonitor(monitor, 1));
-						createdTarget = sdk.findSDKTarget(targetName);
+						sdk.installRootstrap(rootstrap,new SubProgressMonitor(monitor, 1));
 					} catch (MicaException e) {
 						throw new InvocationTargetException(e);
 					}
@@ -261,127 +109,21 @@
 				}
 
 			});
-		} catch (InvocationTargetException e) {
-			if (e.getCause() instanceof ScratchboxException)
-				throw (ScratchboxException) e.getCause();
-			else
-				throw new ScratchboxException(e);
-		} catch (InterruptedException e) {
-			throw new ScratchboxException(e);
+		} catch (Exception e) {
+			ErrorLogger errorLogger = Activator.getErrorLogger();
+			errorLogger.logAndShowError("Cannot install rootstrap "
+					+ rootstrap, e);
 		}
+		return true;
 	}
 
-	private MaemoRootstrap getRootstrap() {
+	private String getRootstrap() {
 		return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
 				.getRootstrap();
 	}
 
-	private boolean useHostTools() {
-		return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
-				.useHostTools();
-	}
 
 	/**
-	 * Return the name of the target to be created.
-	 * 
-	 * @return the name of the target to be created.
-	 */
-	private String getTargetNameSelected() {
-		return ((TargetWizardNamePage) targetNamePage).getTextControl()
-				.getText();
-	}
-
-	/**
-	 * Return the compiler name of the target to be created.
-	 * 
-	 * @return the compiler name of the target to be created.
-	 */
-	private String getCompilerNameSelected() {
-		TableItem item = ((TargetWizardCompilerPage) compilerNamePage)
-				.getTableControl().getSelection()[0];
-		return item.getText();
-	}
-
-	/**
-	 * Return the cputransp name of the target to be created.
-	 * 
-	 * @return the cputransp name of the target to be created.
-	 */
-	private String getCputranspSelected() {
-		TableItem item = ((TargetWizardCPUMethod) cpuMethodName).getTable()
-				.getSelection()[0];
-		return item.getText();
-	}
-
-	/**
-	 * Configure sbrsh service.
-	 */
-	private void configureSbrshService() {
-		String targetName = getTargetNameSelected();
-		String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
-				.getTargetDeviceAddr();
-		String nfsHostname = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
-				.getNFSHostname();
-
-		try {
-			sdk.configureSbrsh(targetName, deviceTargetAddr, nfsHostname);
-		} catch (MicaException e) {
-			ErrorLogger errorLogger = Activator.getErrorLogger();
-			errorLogger.logAndShowError("Cannot configure sbrsh", e);
-		}
-	}
-
-	/**
-	 * Add user at access list of the sbrshd running at the target device.
-	 */
-	private void addUser() {
-		String deviceTargetIP = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
-				.getTargetDeviceIP();
-		String username = System.getProperty("user.name");
-		ErrorLogger errorLogger = Activator.getErrorLogger();
-
-		try {
-			String localAddr = getLocalIP();
-			sdk.addSbrshAccessList(deviceTargetIP, username, localAddr);
-		} catch (MicaException e) {
-			errorLogger
-					.logAndShowError(
-							"Cannot add user to the access list of sbrshd at the target device",
-							e);
-		} catch (UnknownHostException e) {
-			errorLogger.logAndShowError("Cannot get local IP address", e);
-		}
-	}
-
-	/**
-	 * Shows the dialog to ask the user if s/he wants to add his/herself to the
-	 * acess list of the sbrshd.
-	 */
-	private void showsDialog() {
-		String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
-				.getTargetDeviceIP();
-		String text = "Do you want to add yourself to the access list of the sbrshd running on target device? \n";
-		text += "(This requires that "
-				+ deviceTargetAddr
-				+ " has ssh daemon running and sbrshd already installed, and that you have root access).";
-		boolean userAddedAtAccessList = MessageDialog.openQuestion(getShell(),
-				"Scratchbox Configuration", text);
-		if (userAddedAtAccessList) {
-			addUser();
-		}
-	}
-
-	/**
-	 * Get the local IP address.
-	 * 
-	 * @return the local IP address.
-	 * @throws UnknownHostException
-	 */
-	private String getLocalIP() throws UnknownHostException {
-		return InetAddress.getLocalHost().getHostAddress();
-	}
-
-	/**
 	 * We will accept the selection in the workbench to see if we can initialize
 	 * from it.
 	 * 

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -42,7 +42,7 @@
 	protected Object selection;
 	private MaemoRootstrapContentLabelProvider provider;
 	private Button showExistingTargets;
-	private Button useHostTools;
+//	private Button useHostTools;
 
 	/**
 	 * Constructs a NewTargetWizardNamePage.
@@ -55,7 +55,7 @@
 					"This page only expects a scratchbox 2 SDK");
 		}
 		setTitle("Select maemo SDK+ Rootstrap");
-		setDescription("Select the maemo rootstrap to install, or manually configure a target.");
+		setDescription("Select the maemo rootstrap to install.");
 		setPageComplete(false);
 	}
 
@@ -84,11 +84,11 @@
 		showExistingTargets
 				.setToolTipText("If checked, rootstraps with names matching existing targets will be shown.  This is the only way to reinstall a target.");
 
-		useHostTools = new Button(composite, SWT.CHECK);
-		useHostTools.setText("Use host's build tools");
-		useHostTools.setSelection(false);
-		useHostTools
-				.setToolTipText("If checked, configure the rootstrap to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1).  We recommend leaving this unchecked and invoking maemo-tools to install official build tools.");
+//		useHostTools = new Button(composite, SWT.CHECK);
+//		useHostTools.setText("Use host's build tools");
+//		useHostTools.setSelection(false);
+//		useHostTools
+//				.setToolTipText("If checked, configure the rootstrap to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1).  We recommend leaving this unchecked and invoking maemo-tools to install official build tools.");
 
 		// / setup rootstrap target tree
 
@@ -120,7 +120,7 @@
 
 		TreeColumn nameColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
 				SWT.LEFT);
-		nameColumn.setText("Target Name");
+		nameColumn.setText("Rootstrap Name");
 		nameColumn.setWidth(200);
 		nameColumn.setResizable(true);
 
@@ -159,9 +159,9 @@
 						@Override
 						public boolean select(Viewer viewer,
 								Object parentElement, Object element) {
-							if (element instanceof MaemoRootstrap) {
-								MaemoRootstrap rootstrap = (MaemoRootstrap) element;
-								if (sdk.findSDKTarget(rootstrap.getName()) != null)
+							if (element instanceof String) {
+								String rootstrap = (String) element;
+								if (sdk.findSDKTarget(rootstrap) != null)
 									return false;
 							}
 							return true;
@@ -184,8 +184,9 @@
 	 * #perfomeAction()
 	 */
 	public boolean validatePage() {
-		setPageComplete(selection instanceof MaemoRootstrap
-				|| selection == MaemoRootstrapContentLabelProvider.NO_ROOTSTRAP);
+//		setPageComplete(selection instanceof MaemoRootstrap
+//				|| selection == MaemoRootstrapContentLabelProvider.NO_ROOTSTRAP);
+		setPageComplete(selection != null);
 		return true;
 	}
 
@@ -193,18 +194,9 @@
 		return selection instanceof MaemoRootstrap;
 	}
 
-	public MaemoRootstrap getRootstrap() {
-		if (!(selection instanceof MaemoRootstrap))
-			return null;
-		return (MaemoRootstrap) selection;
+	public String getRootstrap() {
+//		if (!(selection instanceof MaemoRootstrap))
+//			return null;
+		return (String) selection;
 	}
-
-	public boolean isShowingExisting() {
-		return showExistingTargets.getSelection();
-	}
-
-	public boolean useHostTools() {
-		return useHostTools.getSelection();
-	}
-
 }
\ No newline at end of file

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/scratchbox/sb2/sdk/IScratchbox2SDK.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/scratchbox/sb2/sdk/IScratchbox2SDK.java	2008-10-31 20:36:28 UTC (rev 915)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/scratchbox/sb2/sdk/IScratchbox2SDK.java	2008-11-03 13:32:15 UTC (rev 916)
@@ -14,6 +14,7 @@
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDK;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.IMachine;
@@ -28,10 +29,10 @@
 	/** Map<String,String> of sb2 target names to rootstrap paths */
 	static final String SB2_TARGET_TO_ROOTSTRAP_MAP = "sb2_target_to_rootstrap_map";
 
-	/**
-	 * @return
-	 */
-	public IPath getScratchbox2ConfigDirectory();
+//	/**
+//	 * @return
+//	 */
+//	public IPath getScratchbox2ConfigDirectory();
 
 	/**
 	 * Create a new rootstrap target for Scratchbox 2. The target is named after
@@ -68,7 +69,7 @@
 	 * @throws MicaException
 	 *             if some problem related to Scratchbox communication occurs.
 	 */
-	public boolean removeRootstrap(String targetName, boolean force,
+	public void removeRootstrap(String targetName, boolean force,
 			IProgressMonitor monitor) throws MicaException;
 
 	/**
@@ -89,7 +90,17 @@
 	 * @return List, never null
 	 * @throws MicaException
 	 */
-	public List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine)
+	public List<String> getAvailableMaemoRootstraps()
 			throws MicaException;
 
+	/**
+	 * Install rootstrap, return 0 if success
+	 * 
+	 * @param rootstrap - nickname of the rootstrap
+	 * @param monitor 
+	 *
+	 * @return 0 - if success
+	 */
+	public int installRootstrap(String rootstrap, IProgressMonitor monitor) throws MicaException;
+
 }



More information about the Esbox-commits mailing list