[Esbox-commits] r861 - in branches/sdkPlugins/maemosdk: org.maemo.esbox.maemosdk.core org.maemo.esbox.maemosdk.core/META-INF org.maemo.esbox.maemosdk.core/conf org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk org.maemo.esbox.maemosdk.sdk1 org.maemo.esbox.maemosdk.sdk1/META-INF org.maemo.esbox.maemosdk.sdk1/conf org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1 org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/provider org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/adapters org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/preferences org.maemo.esbox.maemosdk.sdk2 org.maemo.esbox.maemosdk.sdk2/META-INF org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2 org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/provider org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/preferences org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands org.maemo.esbox.maemosdk.ui/META-INF org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences
baranov at garage.maemo.org
baranov at garage.maemo.org
Fri Oct 10 11:01:47 EEST 2008
Author: baranov
Date: 2008-10-10 11:01:46 +0300 (Fri, 10 Oct 2008)
New Revision: 861
Added:
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/AbstractSDKCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ICommandAbstractor.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxInvalidParameterException.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MachineUtils.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MaemoUtils.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKUtils.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/conf/run.sh
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/AbstractSDK1Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/CreateTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetCurrentTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetVersionScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/KillallCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCompilersCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCputranspCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListDevkitsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListTargetsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RemoveTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ResetTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RootstrapCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/SelectTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ShowTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/SB1PreferenceConstants.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/AbstractSDK2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateMaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetCurrentTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetVersionScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListAvailableMaemoRootstrapsSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCompilersSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCputranspSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListInstalledMaemoRootstrapsSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListTargetsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveMaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ShowPathMappingSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/SB2PreferenceConstants.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters/
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
Removed:
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb1_prefs.xml
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb2_prefs.xml
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/AbstractGetGdbQemuCommandPatternCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVersionScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB1PreferenceConstants.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB2PreferenceConstants.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java
Modified:
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/MaemoEnvironmentUtils.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDK.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDKTarget.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/META-INF/MANIFEST.MF
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/build.properties
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/plugin.xml
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/Activator.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetGdbQemuCommandPatternCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListSessionsCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/IScratchboxSDK1.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1Target.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1EnvironmentProvider.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1ProcessLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/ScratchboxTargetSwitcher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/provider/ScratchboxSDK1Provider.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/preferences/Scratchbox1PreferencesPage.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/META-INF/MANIFEST.MF
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/build.properties
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/plugin.xml
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/Activator.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetGdbQemuCommandPatternCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetMaemoRootstrapLocationCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/MaemoRootstrapSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/IScratchboxSDK2.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2Target.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2EnvironmentProvider.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncherFactory.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/provider/ScratchboxSDK2Provider.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/ESboxTargetRemover.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/preferences/Scratchbox2PreferencesPage.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/MaemoRootstrapContentLabelProvider.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/NewScratchbox2TargetWizard.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/TargetWizardRootstrapSb2Page.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java
branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
Log:
Refactoring complete.
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,13 +14,14 @@
org.maemo.esbox.linux.packages.core;bundle-version="1.5.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Export-Package: org.maemo.esbox.internal.maemosdk.core,
- org.maemo.esbox.internal.maemosdk.core.adapters,
- org.maemo.esbox.internal.maemosdk.core.command,
+Export-Package: org.maemo.esbox.internal.maemosdk.core;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.core.adapters;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.core.command;x-friends:="org.maemo.esbox.maemosdk.tests",
org.maemo.esbox.internal.maemosdk.core.command.scratchbox;x-friends:="org.maemo.esbox.maemosdk.tests",
org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;x-friends:="org.maemo.esbox.maemosdk.tests",
org.maemo.esbox.internal.maemosdk.core.sdk;x-friends:="org.maemo.esbox.maemosdk.tests",
org.maemo.esbox.maemosdk.core,
+ org.maemo.esbox.maemosdk.core.command,
org.maemo.esbox.maemosdk.core.execEnv,
org.maemo.esbox.maemosdk.core.platform,
org.maemo.esbox.maemosdk.core.scratchbox,
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-#/*******************************************************************************
-# * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia.
-# * 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 (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
-# * Ed Swartz (Nokia) - additions and changes
-# *******************************************************************************/
-
-__version=0.5
-__release=1.2
-__location=$1
-__export_list=$2
-shift
-shift
-__command="$@"
-
-if [ ! -d $__location ] ; then
- echo "E: Directory $__location not found"
- exit 1
-fi
-
-cd $__location
-
-# apply exports and unsets
-if [ "$__export_list" != "-" ] ; then
- IFS=,; for __export in $__export_list; do
- case $__export in
- -* ) unset `echo $__export | sed s/-//` ;;
- * ) export $__export ;;
- esac
- done
- IFS=" "
-fi
-
-# Run command
-$__command
-
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb1_prefs.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb1_prefs.xml 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb1_prefs.xml 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
-
-<properties>
- <comment>This file contains the default settings for Scratchbox 1 preferences;
- see the org.maemo.esbox.core.preference_set_provider extension</comment>
-
- <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
- bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
- WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs,
- adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
-
- <entry key="SB1_LOGIN_COMMAND">/scratchbox/login -d ${RUN_SCRIPT_DIRECTORY} "./${RUN_SCRIPT} ${{DIRECTORY}} \\\"${{{EXPORTS}}}\\\" \\\"${{{COMMAND}}} ${{{ARGS}}}\\\""</entry>
- <entry key="SB1_SBOX_COMMAND">sb-conf ${ACTIONS} ${OPTIONS}</entry>
-
- <entry key="RUN_SCRIPT_LOC">/scratchbox/users/${USER}/home/${USER}/.esbox/</entry>
-
- <!-- this uses ${QEMU} because the default qemu-arm is an often misconfigured softlink: see GetGdbQemuCommandPatternCommand -->
- <entry key="SB1_GDB_REMOTE_QEMU">${QEMU} -g ${PORT}</entry>
-
- <!-- actions of command sb-conf -->
-
- <entry key="SB1_VERSION_ACT">version</entry>
- <entry key="SB1_SETUP_ACT">setup</entry>
- <entry key="SB1_INSTALL_ACT">install</entry>
- <entry key="SB1_ROOTSTRAP_ACT">rootstrap</entry>
- <entry key="SB1_SELECT_ACT">select</entry>
- <entry key="SB1_RESET_ACT">reset</entry>
- <entry key="SB1_KILLALL_ACT">killall</entry>
- <entry key="SB1_REMOVE_ACT">remove</entry>
- <entry key="SB1_SHOW_ACT">show</entry>
- <entry key="SB1_LIST_ACT">list</entry>
- <entry key="SB1_CURRENT_ACT">current</entry>
-
- <!-- options for action rootstrap -->
- <entry key="SB1_ROOTSTRAP_OPT_FORCE">--force</entry>
- <entry key="SB1_SETUP_ACT">setup</entry>
-
- <!-- options for action remove -->
- <entry key="SB1_REMOVE_OPT_FORCE">--force</entry>
-
- <!-- options for action setup -->
- <entry key="SB1_SETUP_OPT_COMPILER">--compiler=${COMPILER}</entry>
- <entry key="SB1_SETUP_OPT_DEVKITS">--devkits=${LIST}</entry>
- <entry key="SB1_SETUP_OPT_CPUTRANSP">--cputransp=${METHOD}</entry>
- <entry key="SB1_SETUP_OPT_FORCE">--force</entry>
-
- <!-- options for action killall -->
- <entry key="SB1_KILLALL_OPT_SIGNAL">signal=${SIGNAL}</entry>
-
- <!-- options for action install -->
- <entry key="SB1_INSTALL_OPT_CLIB">--clibrary</entry>
- <entry key="SB1_INSTALL_OPT_ETC">--etc</entry>
- <entry key="SB1_INSTALL_OPT_DEVKITS">--devkits</entry>
- <entry key="SB1_INSTALL_OPT_FAKE">--fakeroot</entry>
- <entry key="SB1_INSTALL_OPT_GDB">--gdb</entry>
- <entry key="SB1_INSTALL_OPT_STRACE">--strace</entry>
-
- <!-- options for action show -->
- <entry key="SB1_SHOW_OPT_COMPILERS">--compilers</entry>
- <entry key="SB1_SHOW_OPT_DEVKITS">--devkits</entry>
- <entry key="SB1_SHOW_OPT_CPU">--cputransp</entry>
- <entry key="SB1_SHOW_OPT_COMP_ARCH">--compiler-arch</entry>
- <entry key="SB1_SHOW_OPT_COMP_SUBARCH">--compiler-subarch</entry>
- <entry key="SB1_SHOW_OPT_COMP_CLIB">--compiler-clib</entry>
-
- <!-- options for action list -->
- <entry key="SB1_LIST_OPT_COMPILERS">--compilers</entry>
- <entry key="SB1_LIST_OPT_DEVKITS">--devkits</entry>
- <entry key="SB1_LIST_OPT_CPU">--cputransps</entry>
- <entry key="SB1_LIST_OPT_TARGETS">--targets</entry>
- <entry key="SB1_LIST_OPT_SESSIONS">--sessions</entry>
-
- <!-- setting such as Scratchbox location and user name -->
- <entry key="SB1_SBOX_SANDBOX">/scratchbox/users/${USER}</entry>
-
-</properties>
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb2_prefs.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb2_prefs.xml 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/conf/sb2_prefs.xml 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
-
-<properties>
- <comment>This file contains the default settings for Scratchbox 2 preferences;
- see the org.maemo.esbox.core.preference_set_provider extension</comment>
-
- <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
- bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
- 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_INSTALL_MAPPING_MODE">emulate</entry>
- <entry key="SB2_LOG_LEVEL"></entry>
-
- <entry key="SB2_EXEC_COMMAND">sb2 -Qx -m ${MAPPING_MODE} ${LOG_OPTION} -t ${TARGET} "${{COMMAND}} ${{ARGS}}"</entry>
-
- <!-- this qemu-arm link is expected to be valid; we don't try to substitute unlike for sb1: see GetGdbQemuCommandPatternCommand -->
- <entry key="SB2_GDB_REMOTE_QEMU">sb2-qemu-arm -g ${PORT}</entry>
-
- <!-- The hash-bang in these scripts don't properly launch bash! -->
- <entry key="SB2_INIT_COMMAND">/bin/bash -c "sb2-init ${{OPTIONS}} ${{TARGET}} ${{COMPILER}}"</entry>
- <entry key="SB2_CONFIG_COMMAND">/bin/bash -c "sb2-config ${{ACTIONS}} ${{OPTIONS}}"</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_COMMAND">/bin/bash -c "maemo-rootstrap ${{OPTIONS}}"</entry>
- <entry key="SB2_SB2_SHOW_COMMAND">sb2-show</entry>
-
- <!-- actions of command sb2-config -->
-
- <entry key="SB2_VERSION_ACT">-v</entry>
- <entry key="SB2_LIST_ACT">-l</entry>
-
- <!-- actions of command maemo-rootstrap -->
- <entry key="SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT">--host-tools</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_FORCE_OPT">--force</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT">available</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_LIST_ACT">list</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_INSTALL_ACT">install</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_REMOVE_ACT">remove</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_PATH_ACT">path</entry>
-
- <!-- actions of command sb2-show -->
- <entry key="SB2_SB2_SHOW_PATH_ACTION">path</entry>
- <entry key="SB2_SB2_SHOW_PATH_OUTPUT_PATTERN">(.+)\s+=>\s+(\S+).*</entry>
-
-</properties>
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml 2008-10-10 08:01:46 UTC (rev 861)
@@ -355,20 +355,6 @@
preferenceStoreBundle="org.maemo.esbox.maemosdk.core"
version="17">
</preferenceSetProvider>
- <preferenceSetProvider
- defaultsXMLFile="conf/sb1_prefs.xml"
- preferenceConstantsClass="org.maemo.esbox.maemosdk.core.SB1PreferenceConstants"
- preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
- preferenceStoreBundle="org.maemo.esbox.maemosdk.core"
- version="17">
- </preferenceSetProvider>
- <preferenceSetProvider
- defaultsXMLFile="conf/sb2_prefs.xml"
- preferenceConstantsClass="org.maemo.esbox.maemosdk.core.SB2PreferenceConstants"
- preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
- preferenceStoreBundle="org.maemo.esbox.maemosdk.core"
- version="17">
- </preferenceSetProvider>
</extension>
</plugin>
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/MaemoEnvironmentUtils.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/MaemoEnvironmentUtils.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/MaemoEnvironmentUtils.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -34,13 +34,10 @@
String display = CorePreferenceManager.getInstance().getRegisteredKeyValue(
MaemoPreferenceConstants.X_DISPLAY);
if (display != null && display.length() > 0) {
- String host = "";
-
- // XXX: provide an accessor from IMachine
- if (serverMachine instanceof IVirtualMachine) {
- host = "10.0.2.2";
+ String host = serverMachine.getLocalMachineAddress();
+ if (host.equals(IMachine.LOCALHOST_ADDRESS)) {
+ host = "";
}
-
envBlock.define("DISPLAY", host + display);
}
}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,45 +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.maemosdk.core.command;
-
-import org.maemo.esbox.core.machine.IFileSystemAccess;
-import org.maemo.esbox.core.process.IProcessLauncherFactory;
-
-/**
- * This interface is used to abstract the way an ICommand is constructed
- * and launched, and the means by which it gets the values to substitute into
- * commands. It may, for instance, either be run in the context of an ISDKTarget,
- * ISDK, or run natively. Similarly, it may be controlled entirely by unit tests.
- *
- * @author eswartz
- *
- */
-public interface ICommandAbstractor {
-
- /**
- * Read a preference for the implicit category of the abstractor.
- * @param key the key to search
- * @return preference value or "" if undefined
- */
- String getPreferenceValue(String key);
-
- /**
- * Get the factory for creating process launchers to run programs in the context of the SDK.
- * @return the process launcher factory, never <code>null</code>
- */
- IProcessLauncherFactory getProcessLauncherFactory();
-
- /**
- * Get the file system access for the filesystem used by the command
- * @return IFilesystemAccess, never <code>null</code>
- */
- IFileSystemAccess getFileSystemAccess();
-}
\ No newline at end of file
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/AbstractGetGdbQemuCommandPatternCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/AbstractGetGdbQemuCommandPatternCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/AbstractGetGdbQemuCommandPatternCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,137 +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.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.runtime.IStatus;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.*;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.*;
-import org.osgi.framework.Version;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Get the command pattern for launching qemu with the debugger
- * @author eswartz
- *
- */
-public abstract class AbstractGetGdbQemuCommandPatternCommand <ScboxSDKTarget extends IScratchboxSDKTarget> extends ScratchboxCommand {
-
- protected ScboxSDKTarget sdkTarget;
-
- public AbstractGetGdbQemuCommandPatternCommand(ScboxSDKTarget sdkTarget, ICommandAbstractor commandAbstractor, int sboxVersion) {
- super(commandAbstractor, sboxVersion);
- this.sdkTarget = sdkTarget;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public abstract String performCommand(List<String> param)throws ScratchboxException, ESboxException;
-// {
-// if (!this.checkParameters(param))
-// throw new ScratchboxInvalidParameterException(
-// "Invalid number of parameters");
-//
-// String commandPattern = null;
-//
-// String architecture = param.get(0);
-//
-// if (architecture.equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL))
-// {
-// if (sdkTarget instanceof IScratchbox1SDKTarget) {
-// // scratchbox often misconfigures the softlinks, so explicitly launch the qemu configured for the target
-// String qemu = getConfiguredQemu();
-// if (qemu == null) {
-// // fallback
-// Activator.getErrorLogger().log(IStatus.WARNING,
-// "Target " + sdkTarget + " does not seem to use qemu, so assuming qemu-arm for debugging", null);
-// qemu = "qemu-arm";
-// }
-//
-// // get the version
-// Version version = null;
-// Pattern versionPattern = Pattern.compile("qemu-.*((\\d+)\\.(\\d+)\\.(\\d+))-.*");
-// Matcher matcher = versionPattern.matcher(qemu);
-// if (matcher.matches()) {
-// version = new Version(matcher.group(1));
-// }
-//
-// // For ARM emulator debug, use "qemu-arm" command.
-// commandPattern = sdkTarget.getPreferenceValue(SB1PreferenceConstants.SB1_GDB_REMOTE_QEMU);
-//
-// if (version != null && version.compareTo(new Version(0, 8, 0)) < 0) {
-// // hide ${PORT}, which doesn't exist in 0.7.x
-// commandPattern = commandPattern.replace("${PORT}", "");
-// //Activator.getErrorLogger().log(IStatus.WARNING,
-// // "The version of qemu-arm in use (" + version + ") is too old -- debugging may not work. Check your softlinks in /scratchbox/devkits/cputransp/bin/.", null);
-// }
-//
-// commandPattern = commandPattern.replace("${QEMU}", qemu);
-//
-// } else if (sdkTarget instanceof IScratchbox2SDKTarget) {
-// // we think this always uses a new enough version, so keep ${PORT}
-// commandPattern = sdkTarget.getPreferenceValue(SB2PreferenceConstants.SB2_GDB_REMOTE_QEMU);
-// } else {
-// throw new ScratchboxException("unknown scratchbox version");
-// }
-// }
-// else {
-// // The others, just standard "gdbserver" command.
-// commandPattern = sdkTarget.getPreferenceValue(MaemoPreferenceConstants.SBOX_GDB_REMOTE);
-// }
-//
-// return commandPattern;
-// }
-
- /**
- * Find what qemu is configured for this target.
- * @return qemu name, or <code>null</code> if not using qemu
- */
- protected String getConfiguredQemu() throws ESboxException {
-
- // we use sb-select show <target> to find out if qemu is even used for this target.
- String showAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SHOW_ACT);
- String showInfoCommandString = this
- .replaceScratchboxConfigCommand(showAction,
- new String[] { sdkTarget.getName() });
-
- Process process = createProcess(showInfoCommandString, null);
-
- List<String> lines = getLineInputFromProcessAndWait(process, true, 0);
-
- // see if this is the line describing CPU transparency
- Pattern namePattern = Pattern.compile(".*/(qemu-\\S+).*");
- for (String line : lines) {
- Matcher matcher = namePattern.matcher(line);
- if (matcher.matches()) {
- return matcher.group(1);
- }
- }
-
- return null;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,93 +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.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.core.*;
-
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.*;
-
-/**
- * Creates a new rootstrap for a target, if it does not exist.
- * This command wraps the callback to service:
- * <p>
- * maemo-rootstrap [--force] install <target>
- *
- */
-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;
- }
-
- @Override
- 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, ESboxException {
- 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,
- CorePlugin.getDefault().getConsole(true, null, "Installing rootstrap " + targetName));
- doPerformCommand(params, envBlock, 0);
-
- sdk.refresh();
-
- return true;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,114 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-
-import java.util.List;
-
-/**
- * Creates a new target, if it does not exist.
- * This command wraps the callback to service sb-conf setup [<TARGET>]
- * [--compiler=<COMPILER>]
- * [--devkits=<LIST>]
- * [--cputransp=<METHOD>]
- * [--force]
- *
- */
-public class CreateTargetCommand extends ScratchboxCommand {
-
-
- private ISDK sdk;
-
- public CreateTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- this.sdk = sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public Object performCommand(List<String> param) throws ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetName = param.get(0);
- String compilerName = param.get(1);
- String devkitsNames = param.get(2);
- String cputranspName = param.get(3);
-
- String setupTargetAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SETUP_ACT);
-
- String[] setupActionOptionsReplaced = this.replaceActions(targetName,
- compilerName, devkitsNames, cputranspName);
- String setupTargetCommand = this.replaceScratchboxConfigCommand(
- setupTargetAction, setupActionOptionsReplaced);
-
- Process process = createProcess(setupTargetCommand, null);
-
- getInputFromProcessAndWait(process, false, 0);
-
- sdk.refresh();
-
- return true;
- }
-
- /**
- * Replace the options of action SETUP. The options of SETUP action are
- * different from the other ones, so this method replaces the variables
- * properly.
- *
- * @param targetName
- * the name of the target.
- *
- * @param compiler
- * the compiler name of the target.
- * @param devkits
- * the devkits of the target.
- * @param cputransp
- * the cputransp method of the target.
- * @return an array of String with the options already modified with the
- * options.
- */
- protected String[] replaceActions(String targetName, String compiler,
- String devkits, String cputransp) {
- String[] setupActions = new String[4];
- setupActions[0] = targetName;
- setupActions[1] = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SETUP_OPT_COMPILER);
- setupActions[2] = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SETUP_OPT_DEVKITS);
- setupActions[3] = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SETUP_OPT_CPUTRANSP);
-
- setupActions[1] = setupActions[1].replaceAll("\\$\\{COMPILER\\}",
- compiler);
- setupActions[2] = setupActions[2].replaceAll("\\$\\{LIST\\}", devkits);
- setupActions[3] = setupActions[3].replaceAll("\\$\\{METHOD\\}",
- cputransp);
-
- return setupActions;
- }
-
- @Override
- public int getParametersSize() {
- return 4;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -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.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.process.*;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-
-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 ScratchboxCommand {
-
-
- private ISDK sdk;
-
- public CreateTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- 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 ESboxException {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,65 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
-
-import java.util.List;
-
-/**
- * Get the current Scratchbox 1 target.
- * This command wraps the callback to service sb-conf current
- */
-public class GetCurrentTargetCommand extends ScratchboxCommand {
-
- private final IScratchboxSDK sdk;
-
- public GetCurrentTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
- super(commandAbstractor, 1);
- this.sdk = sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public String performCommand(List<String> param) throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- if (sdk.getCachedCurrentTarget() != null)
- return sdk.getCachedCurrentTarget();
-
- String currentTargetAction = commandAbstractor.getPreferenceValue(SB1PreferenceConstants.SB1_CURRENT_ACT);
- String currentTargetCommand = this
- .replaceScratchboxConfigCommand(currentTargetAction);
-
- Process process = createProcess(currentTargetCommand, null);
-
- String currentTarget = getInputFromProcessAndWait(process, true, 0);
-
- sdk.setCachedCurrentTarget(currentTarget);
- return currentTarget;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,81 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-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.core.*;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-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 ScratchboxCommand {
-
- public GetCurrentTargetSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public String performCommand(List<String> param) throws ScratchboxException, ESboxException {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVersionScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVersionScratchboxCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVersionScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,72 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * Get the version of Scratchbox installed.
- * This command wraps the callback to service sb-conf version.
- *
- */
-public class GetVersionScratchboxCommand extends ScratchboxCommand {
-
- public GetVersionScratchboxCommand(ICommandAbstractor commandAbstractor, int version) {
- super(commandAbstractor, version);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
- */
- public int getParametersSize() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
- */
- public String performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(params))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String sboxVersionAction;
- if (sboxVersion == 1)
- sboxVersionAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_VERSION_ACT);
- else
- sboxVersionAction = commandAbstractor.getPreferenceValue(
- SB2PreferenceConstants.SB2_VERSION_ACT);
-
- String currentSboxVersionCommand = this
- .replaceScratchboxConfigCommand(sboxVersionAction);
-
- Process process = createProcess(currentSboxVersionCommand, null);
-
- String currentVersion = getInputFromProcessAndWait(process, false, 0);
-
- return currentVersion;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,90 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * Kill all Scratchbox sessions.
- * This command wraps the callback to service sb-conf killall [-signal=<SIGNAL>]
- *
- */
-public class KillallCommand extends ScratchboxCommand {
-
- public KillallCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String signalValue = "";
- if (param.size() > 0)
- signalValue = param.get(0);
-
- String killallAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_KILLALL_ACT);
- String signalOption = this.replaceSignal(signalValue);
- String killallCommand = this.replaceScratchboxConfigCommand(
- killallAction, new String[] { signalOption });
-
- Process process = createProcess(killallCommand, null);
-
- getInputFromProcessAndWait(process, false, 0);
-
- return true;
- }
-
- /**
- * Replace the value of SIGNAL option of killall action.
- *
- * @param signalValue
- * the value of the signal to be replaced.
- * @return the signal option of killall action replaced with the given
- * signal value.
- */
- private String replaceSignal(String signalValue) {
- if (signalValue.equals(""))
- return "";
- String killallSignalOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_KILLALL_OPT_SIGNAL);
-
- String signalReplaced = killallSignalOption.replaceAll(
- "\\$\\{SIGNAL\\}", signalValue);
-
- return signalReplaced;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- // TODO Auto-generated method stub
- return getParametersSize() <= 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -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
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-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, ESboxException {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,62 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * List the installed compilers.
- * This command wraps the callback to service sb-conf list --compilers
- *
- */
-public class ListCompilersCommand extends ScratchboxCommand {
-
- public ListCompilersCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_ACT);
- String compilersOptions = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_OPT_COMPILERS);
- String listCompilersCommand = this.replaceScratchboxConfigCommand(
- listAction, new String[] { compilersOptions });
-
- Process process = createProcess(listCompilersCommand, null);
-
- List<String> compilersAvailable = getLineInputFromProcessAndWait(process, true, 0);
-
- return compilersAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,75 +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.maemosdk.core.command.scratchbox;
-
-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.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-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 ScratchboxCommand {
-
- public ListCompilersSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,63 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * List the installed cpu-transparency.
- * This command wraps the callback to service sb-conf list --cputransps
- *
- */
-public class ListCputranspCommand extends ScratchboxCommand {
-
- public ListCputranspCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_ACT);
- String cputranpOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_OPT_CPU);
- String listCputranspsCommandString = this
- .replaceScratchboxConfigCommand(listAction,
- new String[] { cputranpOption });
-
- Process process = createProcess(listCputranspsCommandString, null);
-
- List<String> cputranspsAvailable = getLineInputFromProcessAndWait(process, true, 0);
-
- return cputranspsAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,76 +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.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.*;
-
-/**
- * List the installed compilers.
- * There's no known command for this, but we can look in specific places.
- *
- */
-public class ListCputranspSb2Command extends ScratchboxCommand {
-
- public ListCputranspSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- List<String> cputranspAvailable = new ArrayList<String>();
-
- Set<String> expected = new HashSet<String>();
- expected.add("sb2-qemu-arm");
- expected.add("sbrsh");
-
- Properties env = ProcessLauncherUtils.getSynthesizedEnvironment(commandAbstractor.getProcessLauncherFactory());
- String pathenv = env.getProperty("PATH");
- if (pathenv == null) {
- pathenv = "/usr/bin:/bin"; // XXX
- }
- if (pathenv != null) {
- String[] paths = pathenv.split(":");
- for (String exp : expected) {
- for (String path : paths) {
- IFileStore bin = commandAbstractor.getFileSystemAccess().getFileStore(new Path(path).append(exp));
- if (bin.fetchInfo().exists()) {
- cputranspAvailable.add(bin.toURI().getPath());
- break;
- }
- }
- }
- }
-
- return cputranspAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,62 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * List the installed devkits.
- * This command wraps the callback to service sb-conf list --devkits
- *
- */
-public class ListDevkitsCommand extends ScratchboxCommand {
-
- public ListDevkitsCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_ACT);
- String devkitsOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_OPT_DEVKITS);
- String listDevkitsCommandString = this.replaceScratchboxConfigCommand(
- listAction, new String[] { devkitsOption });
-
- Process process = createProcess(listDevkitsCommandString, null);
-
- List<String> devkitsAvailable = getLineInputFromProcessAndWait(process, true, 0);
-
- return devkitsAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,60 +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.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-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, ESboxException {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,79 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * List the current Scratchbox sessions.
- * This command wraps the callback to service sb-conf list --sessions
- *
- */
-public class ListSessionsCommand extends ScratchboxCommand {
-
- public ListSessionsCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_ACT);
- String sessionsOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_OPT_SESSIONS);
- String listSessionsCommandString = this.replaceScratchboxConfigCommand(
- listAction, new String[] { sessionsOption });
-
- Process process = createProcess(listSessionsCommandString, null);
-
- List<String> sessionLines = getLineInputFromProcessAndWait(process, true, 0);
-
- List<String> sessionsAvailable = new ArrayList<String>();
-
- // remove prefix text
- for (String line : sessionLines) {
- int idx = line.indexOf(':');
- if (idx >= 0) {
- String[] pids = line.substring(idx+1).split("\\s+");
- for (String pid : pids) {
- pid = pid.trim();
- if (pid.length() > 0)
- sessionsAvailable.add(pid);
- }
- }
- }
-
-
- return sessionsAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,72 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-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 ScratchboxCommand {
-
- public ListTargetsCommand(ICommandAbstractor commandAbstractor, int sboxVersion) {
- super(commandAbstractor, sboxVersion);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction;
- String targetsOption;
- if (sboxVersion == 1) {
- listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_ACT);
- targetsOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_LIST_OPT_TARGETS);
- } else {
- 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -11,7 +11,8 @@
*******************************************************************************/
package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.ui.console.*;
import org.maemo.esbox.core.*;
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
@@ -19,11 +20,12 @@
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.maemosdk.core.Activator;
import org.maemo.esbox.internal.maemosdk.core.MaemoEnvironmentUtils;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import java.io.*;
import java.util.*;
/**
@@ -34,7 +36,7 @@
private ISDKTarget sdkTarget;
public MaemoCommand(ICommandAbstractor commandAbstractor, ISDKTarget sdkTarget) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
this.sdkTarget = sdkTarget;
}
@@ -49,22 +51,6 @@
}
/*
- * private Properties getVariablesSet() {
- StorableEnvironment env = ESboxEnvironmentVariableManager.fUserSupplier.getWorkspaceEnvironmentCopy();
- ESboxStorableEnvironment esboxEnv = new ESboxStorableEnvironment(env.getVariables(),env.isReadOnly());
- IEnvironmentVariable[] variable = esboxEnv.getVariables();
-
- Properties properties = new Properties();
- for (int i = 0; i < variable.length; i++) {
- IEnvironmentVariable environmentVariable = variable[i];
- properties.put(environmentVariable.getName(), environmentVariable.getValue());
- }
-
- return properties;
- }
- */
-
- /*
* (non-Javadoc)
*
* @see org.maemo.esbox.internal.core.command.ICommand#performCommand(java.util.List)
@@ -85,22 +71,48 @@
IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, null,
Collections.singletonList(maemoCommand), envBlock);
-
+
Process process = processLauncher.createProcess();
- // XXX: see why this hangs
- // read the first line to check for error
- InputParser inputParser = new InputParser(process.getInputStream());
- inputParser.run();
-
// spit the consumed output to the console
MessageConsole console = CorePlugin.getDefault().getConsole(
true, sdkTarget, "Running Maemo command (" + params.get(0) + ")");
- try {
- console.newOutputStream().write(inputParser.data().getBytes());
- } catch (IOException e) {
- }
+ 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 ESboxException(content));
+ }
+
+ });
+
// emit everything else to the console
processLauncher.redirectToConsole(console);
@@ -155,45 +167,4 @@
private String replaceActions(String command, String action) {
return command.replaceAll("\\$\\{ACTIONS\\}", action);
}
-
- /**
- * Examine the output to ensure the first line is not an error.
- */
- public class InputParser implements Runnable {
-
- boolean firstLine = true;
- private InputStream input;
- private StringBuilder data;
-
- public InputParser(InputStream input) {
- this.input = input;
- this.data = new StringBuilder();
- }
-
- public void run() {
- BufferedReader reader = new BufferedReader(new InputStreamReader(input));
- try {
- String line = "";
- if( (line = reader.readLine()) != null ) {
- // get the rest of the buffered content
- data.append(line);
- while (reader.ready())
- data.append((char)reader.read());
-
- if (line.startsWith("ERROR"))
- throw new ScratchboxInvalidOperationException(line);
- }
- } catch (Exception e) {
- ErrorLogger errorLogger = Activator.getErrorLogger();
- errorLogger.logAndShowError("Error launching maemo", e);
- }
- }
-
- public String data() {
- return data.toString();
- }
-
- }
-
-
}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,83 +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.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.*;
-
-/**
- * Base class for maemo rootstrap command.
- */
-public abstract class MaemoRootstrapSb2Command extends ScratchboxCommand {
-
- public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- }
-
- @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 ESboxException {
- 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;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,85 +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.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.core.*;
-
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.*;
-
-/**
- * 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, ESboxException {
- 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,
- CorePlugin.getDefault().getConsole(true, null, "Removing rootstrap " + targetName));
-
- doPerformCommand(commands, envBlock, 0);
-
- return Boolean.TRUE;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,90 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Remove a Scratchbox target.
- * This command wraps the callback to service sb-conf remove [<TARGET>]
- *
- */
-public class RemoveTargetCommand extends ScratchboxCommand {
-
- private ISDK sdk;
-
- public RemoveTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- this.sdk = sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
- 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.");
-
- String removeTargetAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_REMOVE_ACT);
- String forceRemoveTargetOption = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_REMOVE_OPT_FORCE);
- String removeTargetCommand = this.replaceScratchboxConfigCommand(
- removeTargetAction, new String[] { targetToRemove,
- forceRemoveTargetOption });
-
- Process process = createProcess(removeTargetCommand, null);
-
- getInputFromProcessAndWait(process, true, 0);
-
- 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 ESboxException {
- List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor, sboxVersion)
- .performCommand(new ArrayList<String>());
- return targetsAvailable.contains(targetToRemove);
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,60 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * Reset a Scratchbox target.
- * This command wraps the callback to service sb-conf reset [<TARGET>]
- *
- */
-public class ResetTargetCommand extends ScratchboxCommand {
-
- public ResetTargetCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
- */
- public Object performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(params))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String resetTargetAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_RESET_ACT);
- String resetTargetCommand = this.replaceScratchboxConfigCommand(
- resetTargetAction, new String[] {});
-
- Process process = createProcess(resetTargetCommand, null);
-
- getInputFromProcessAndWait(process, false, 0);
-
- return true;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,59 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.util.List;
-
-/**
- * This command wraps the callback to service sb-conf rootstrap [<TARGET>] <FILE>|<URL>
- */
-public class RootstrapCommand extends ScratchboxCommand {
-
- public RootstrapCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String fileOrURL = param.get(0);
-
- String rootstrapAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_ROOTSTRAP_ACT);
- String rootstrapCommand = this.replaceScratchboxConfigCommand(
- rootstrapAction, new String[] { fileOrURL });
-
- Process process = createProcess(rootstrapCommand, null);
-
- getInputFromProcessAndWait(process, false, 0);
-
- return true;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,578 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.ui.console.MessageConsole;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.*;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.*;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.io.*;
-import java.security.InvalidParameterException;
-import java.util.*;
-
-/**
- * Implements some common methods for Scratchbox commands.
- * <p>
- * <b>NOTE:</b> this base class should only be used for basic scratchbox utility
- * command launching. It is not recommended to use this class's
- * string-substitution method to create general command lines, since this
- * ignores details like shell escaping and quoting, which should be
- * constructed with the List<String> class and alternate IProcessLauncherFactory
- * methods.
- */
-public abstract class ScratchboxCommand implements ICommand {
-
- /**
- *
- */
- private static final IStatus CANCEL_STATUS = Policy.getCancelStatus(Activator.getDefault());
-
- public static final String ERROR_TOKEN = "ERROR:"; //$NON-NLS-1$
-
- public static final String WARNING_TOKEN = "sb-conf:"; //$NON-NLS-1$
-
- protected ICommandAbstractor commandAbstractor;
-
- protected int sboxVersion;
-
- protected MessageConsole console;
-
- private IProgressMonitor monitor;
-
- public ScratchboxCommand(ICommandAbstractor commandAbstractor, int sboxVersion) {
- this.commandAbstractor = commandAbstractor;
- this.sboxVersion = sboxVersion;
- }
-
- /**
- * Replace the actions and options of the Scratchbox configure command. This
- * is an utility method to be used by all the subclasses of
- * IScratchboxCommand.
- *
- * @param sboxCommand
- * The Scratchbox command.
- * @param action
- * The action to be replace.
- * @return The result command with the replacement of action made.
- */
- public String replaceScratchboxConfigCommand(String action) {
- return this.replaceScratchboxConfigCommand(action, null);
- }
-
- /**
- * Replace the actions and options of the Scratchbox configure command. This
- * is an utility method to be used by all the subclasses of
- * IScratchboxCommand.
- *
- * @param action
- * The action to be replace.
- * @param options
- * The options to be replace. If the value of options is null, it
- * is supposed to not consider any option.
- * @return The result command with all the replacements (actions and
- * options) made.
- *
- * @throws InvalidParameterException
- * if parameters action or command is null.
- */
- public String replaceScratchboxConfigCommand(String action, String[] options)
- throws InvalidParameterException {
- String sboxCommand;
-
- if (sboxVersion == 1)
- sboxCommand = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SBOX_COMMAND);
- else
- sboxCommand = commandAbstractor.getPreferenceValue(
- SB2PreferenceConstants.SB2_CONFIG_COMMAND);
-
- return replaceScratchboxCommand(sboxCommand, action, options);
- }
-
- /**
- * Replace the actions and options of the sbrsh configure command.
- *
- * @param action
- * The action to be replace.
- * @return The result command with the replacement of action made.
- */
- public String replaceScratchboxSbrshConfigCommand(String action) {
- return this.replaceScratchboxSbrshConfigCommand(action, null);
- }
-
- /**
- * Replace the actions and options of the sbrsh configure command.
- *
- * @param action
- * The action to be replace.
- * @param options
- * The options to be replace. If the value of options is null, it
- * is supposed to not consider any option.
- * @return The result command with all the replacements (actions and
- * options) made.
- *
- * @throws InvalidParameterException
- * if parameters action or command is null.
- */
- public String replaceScratchboxSbrshConfigCommand(String action,
- String[] options) throws InvalidParameterException {
- String sbrshConfigCommand = commandAbstractor.getPreferenceValue(
- MaemoPreferenceConstants.SBRSH_CONFIG_COMMAND);
-
- return replaceScratchboxCommand(sbrshConfigCommand, action, options);
- }
-
- /**
- * Replace the actions and options of a given Scratchbox command.
- *
- * @param command
- * The command with actions and options to be replaced.
- * @param action
- * The action to be replaced.
- * @param options
- * The options to be replace. If the value of options is null, it
- * is supposed to not consider any option.
- * @return The result command with all the replacements (actions and
- * options) made.
- * @throws InvalidParameterException
- * if parameters action or command is null.
- */
- protected String replaceScratchboxCommand(String command, String action,
- String[] options) throws InvalidParameterException {
- if (command == null || action == null)
- throw new InvalidParameterException("The parameters cannot be null");
-
- String resultCommand;
- String optionsToReplace = "";
- String separator = "";
-
- if (options != null) {
- for (int i = 0; i < options.length; i++) {
- optionsToReplace += separator + options[i];
- separator = " ";
- }
- }
-
- ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
- substitutor.define("ACTIONS", action);
- substitutor.define("OPTIONS", optionsToReplace);
-
- resultCommand = substitutor.substitute(command);
-
- return resultCommand;
- }
-
- /**
- * For long-running process, provide a progress monitor and
- * the console to which to report results of an executing command.
- * If not set, or set to <code>null</code>, there will be no console output.
- * @param monitor
- * @param console
- */
- protected void setMonitorAndConsole(IProgressMonitor monitor, MessageConsole console) {
- this.monitor = monitor;
- this.console = console;
- }
-
-
- /**
- * Create a process from the given process launch handler factory and
- * the given command line.
- * @param launcherFactory the factory for creating IProcessLauncherFactory
- * @param commandLine the command line string
- * @throws ScratchboxException failure to launch process
- */
- public Process createProcess(List<String> cmdLine) throws ESboxException {
- IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
- commandAbstractor.getProcessLauncherFactory(),
- null,
- cmdLine);
- Process process = processLauncher.createProcess();
- if (console != null) {
- new PrintStream(console.newMessageStream()).println(CommandLineArguments.toCommandLine(cmdLine));
- processLauncher.redirectToConsole(console);
- }
- return process;
- }
-
- /**
- * Create a process from the given process launch handler factory and
- * the given command line.
- * @param launcherFactory the factory for creating IProcessLauncherFactory
- * @param commandLine the command line string
- * @throws ScratchboxException failure to launch process
- */
- public Process createProcess(String commandline) throws ESboxException {
- return createProcess(commandline, null);
- }
-
- /**
- * Create a process from the given process launch handler factory and
- * the given command line.
- * @param commandLine the command line string
- * @param envBlock prperties
- * @throws ScratchboxException failure to launch process
- */
- public Process createProcess(String commandline, IEnvironmentModifierBlock envBlock) throws ESboxException {
- List<String> cmdLine = CommandLineArguments.createFromCommandLine(commandline);
- IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
- commandAbstractor.getProcessLauncherFactory(),
- null,
- cmdLine,
- envBlock);
- Process process = processLauncher.createProcess();
- if (console != null) {
- new PrintStream(console.newMessageStream()).println(commandline);
- processLauncher.redirectToConsole(console);
- }
- return process;
- }
-
- /**
- * Eat the stdout and stderr results from the process and wait for it
- * to finish. Optionally check whether stderr is empty.
- * <p>
- * This is done here instead of in the commands because CDT's Spawner will
- * destroy the streams when #waitFor() is called, while other Process
- * implementations don't do this, and we don't want a dependency on the
- * ordering repeated in the command implementations.
- * @return stdout results, as a string
- */
- protected String getInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
- return getInputFromProcessAndWait(process, allowError, 0);
- }
-
- protected IStatus runAndWaitForProcess(String jobName, final String commandline,
- IEnvironmentModifierBlock envBlock, long timeout) throws ESboxException {
- final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
- commandAbstractor.getProcessLauncherFactory(),
- null,
- CommandLineArguments.createFromCommandLine(commandline),
- envBlock);
- processLauncher.usePTY(true);
-
- final Process process = processLauncher.createProcess();
- new PrintStream(console.newMessageStream()).println(commandline);
-
- Job job = new Job(jobName) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("", 2);
- monitor.subTask("Running " + commandline);
- try {
- processLauncher.redirectToConsole(console);
- try {
- process.waitFor();
- monitor.worked(1);
- int exit = process.exitValue();
- if (exit != 0) {
- return Activator.createErrorStatus("Process failed with exit value " + exit, null);
- }
- } catch (InterruptedException e) {
- return CANCEL_STATUS;
- }
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- try {
- long deadline = System.currentTimeMillis() + timeout;
- while (job.getResult() == null) {
- Thread.sleep(500);
- if (monitor.isCanceled() || (timeout != 0 && System.currentTimeMillis() >= deadline)) {
- process.destroy();
- job.cancel();
- return CANCEL_STATUS;
- }
- }
- return job.getResult();
- } catch (InterruptedException e) {
- return CANCEL_STATUS;
- }
- }
-
- /**
- * Wait for the process to finish with a certain timeout.
- * @param timeout if not zero, timeout in milliseconds before throwing exception
- * @return exit code
- */
- protected int waitForProcess(final Process process, final long timeout) throws ScratchboxException {
- final Exception[] excs = { null };
- Runnable runnable = new Runnable() {
-
- public void run() {
- try {
- process.waitFor();
- } catch (InterruptedException e) {
- excs[0] = e;
- }
- }
-
- };
-
- if (timeout == 0) {
- runnable.run();
- } else {
- Thread thread = new Thread(runnable);
- thread.start();
- try {
- thread.join(timeout);
- if (thread.isAlive()) {
- thread.interrupt();
- excs[0] = new InterruptedException();
- }
- } catch (InterruptedException e) {
- excs[0] = e;
- }
- }
-
- if (excs[0] instanceof InterruptedException) {
- throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
- } else if (excs[0] instanceof ScratchboxException) {
- throw (ScratchboxException) excs[0];
- } else if (excs[0] != null) {
- throw new ScratchboxException(excs[0]);
- }
-
- return process.exitValue();
- }
-
- /**
- * Eat the stdout and stderr results from the process and wait for it
- * to finish. Optionally check whether stderr is empty.
- * <p>
- * This is done here instead of in the commands because CDT's Spawner will
- * destroy the streams when #waitFor() is called, while other Process
- * implementations don't do this, and we don't want a dependency on the
- * ordering repeated in the command implementations.
- * @param timeout if not zero, timeout in milliseconds before throwing exception
- * @return stdout results, as a string
- */
- protected String getInputFromProcessAndWait(final Process process, final boolean allowError, final long timeout) throws ScratchboxException {
- final String[] inputs = { null };
- final Exception[] excs = { null };
- Runnable runnable = new Runnable() {
-
- public void run() {
- try {
- inputs[0] = getInputFromProcess(process);
-
- if (!allowError) {
- String error = getErrorInputFromProcess(process);
- if (error.length() > 0) {
- excs[0] = new ScratchboxInvalidOperationException(error);
- return;
- }
- }
- } catch (IOException e) {
- excs[0] = e;
- return;
- } catch (ScratchboxException e) {
- excs[0] = e;
- return;
- }
-
- try {
- process.waitFor();
- } catch (InterruptedException e) {
- excs[0] = e;
- }
- }
-
- };
-
- if (timeout == 0) {
- runnable.run();
- } else {
- Thread thread = new Thread(runnable);
- thread.start();
- try {
- thread.join(timeout);
- if (thread.isAlive()) {
- thread.interrupt();
- process.destroy();
- excs[0] = new InterruptedException();
- }
- } catch (InterruptedException e) {
- excs[0] = e;
- }
- }
-
- if (excs[0] instanceof InterruptedException) {
- throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
- } else if (excs[0] instanceof ScratchboxException) {
- throw (ScratchboxException) excs[0];
- } else if (excs[0] != null) {
- throw new ScratchboxException(excs[0]);
- }
-
- return inputs[0];
- }
-
- /**
- * Eat the stdout and stderr results from the process and wait for it
- * to finish. Return a
- * <p>
- * This is done here instead of in the commands because CDT's Spawner will
- * destroy the streams when #waitFor() is called, while other Process
- * implementations don't do this, and we don't want a dependency on the
- * ordering repeated in the command implementations.
- * @return stdout results, as an array of lines
- */
- protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
- return getLineInputFromProcessAndWait(process, allowError, 0);
- }
-
- /**
- * Eat the stdout and stderr results from the process and wait for it
- * to finish. Return a
- * <p>
- * This is done here instead of in the commands because CDT's Spawner will
- * destroy the streams when #waitFor() is called, while other Process
- * implementations don't do this, and we don't want a dependency on the
- * ordering repeated in the command implementations.
- * @param timeout if non-zero, timeout in milliseconds
- * @return stdout results, as an array of lines
- */
- protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError, long timeout) throws ScratchboxException {
- String input = getInputFromProcessAndWait(process, allowError, timeout);
- return processLines(input);
- }
-
- /**
- * Return the input stream of the process as a string. All lines generated
- * by the process are concatenated.
- *
- * @param process
- * the process.
- * @return the input stream of the process.
- * @throws IOException
- * if any I/O problem occurrs.
- */
- private String getInputFromProcess(Process process) throws IOException, ScratchboxException {
- return getInputStream(process.getInputStream());
- }
-
- /**
- * Return the error input stream of the process as a string. All lines
- * generated by the process are concatenated.
- *
- * @param process
- * the process.
- * @return the input stream of the process.
- * @throws IOException
- * if any I/O problem occurrs.
- * @throws ScratchboxException
- */
- private String getErrorInputFromProcess(Process process) throws IOException, ScratchboxException {
- return getInputStream(process.getErrorStream());
- }
-
- /**
- * Return an input stream as a string. All lines generated by the process
- * are concatenated.
- *
- * @param processInputStream
- * the input stream to be read.
- * @return the input stream of the process.
- * @throws IOException
- * if any I/O problem occurrs.
- * @throws ScratchboxException
- */
- private String getInputStream(InputStream processInputStream)
- throws IOException, ScratchboxException {
- BufferedReader in = new BufferedReader(new InputStreamReader(
- processInputStream));
-
- String line;
- String result = "";
- String separator = "";
-
- while ((line = in.readLine()) != null) {
- checkError(line,ERROR_TOKEN);
- checkError(line,WARNING_TOKEN);
- result += separator + line;
- separator = System.getProperty("line.separator");
- }
-
- return result;
- }
-
- private void checkError(String inputString, String errorPattern) throws ScratchboxException {
- if (inputString.startsWith(errorPattern)) {
- int index = inputString.indexOf(errorPattern);
- throw new ScratchboxException(inputString.substring(index + errorPattern.length()));
- }
- }
-
- /**
- * Get a string with a set of lines an return a list with the lines
- * separated.
- *
- * @param stringWithLines
- * a string with lines.
- * @return a list with the lines separated.
- */
- private List<String> processLines(String stringWithLines) {
- List<String> lines = new ArrayList<String>();
- final String FILE_SEPARATOR = System.getProperty("line.separator");
-
- StringTokenizer tokens = new StringTokenizer(stringWithLines,
- FILE_SEPARATOR);
- while (tokens.hasMoreElements()) {
- lines.add(tokens.nextToken());
- }
-
- return lines;
- }
-
- /**
- * Return the correct size of performCommand parameters list.
- *
- * @return the correct size of performCommand parameters list.
- */
- public abstract int getParametersSize();
-
- /**
- * Verify if the parameter list has the correct size.
- *
- * @param param
- * the list of parameters to be verified.
- * @return true, if the list contains the correct number of parameters;
- * false, otherwise.
- */
- protected boolean checkParameters(List<String> param) {
- return getParametersSize() == param.size();
- }
-
-
- protected String catenateLines(List<String> lines) {
- StringBuilder builder = new StringBuilder();
- for (String line : lines) {
- builder.append(line);
- builder.append('\n');
- }
- return builder.toString();
- }
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-/**
- * This exception is thrown whenever an invalid parameter is passed to a command.
- */
-public class ScratchboxInvalidParameterException extends ScratchboxException {
-
- /**
- * Serial version number of exception.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor.
- *
- * @param message
- * the message associated with the exception.
- */
- public ScratchboxInvalidParameterException(String message) {
- super(message);
- }
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,67 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
-
-import java.util.List;
-
-/**
- * Select a Scratchbox target.
- * This command wraps the callback to service sb-conf select [<TARGET>]
- *
- */
-public class SelectTargetCommand extends ScratchboxCommand {
-
- private final IScratchboxSDK sdk;
-
- public SelectTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
- super(commandAbstractor, 1);
- this.sdk = sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
- */
- public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetToSelect = param.get(0);
-
- String selectTargetAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SELECT_ACT);
- String selectTargetCommand = this.replaceScratchboxConfigCommand(
- selectTargetAction, new String[] { targetToSelect });
-
- Process process = createProcess(selectTargetCommand, null);
-
- getInputFromProcessAndWait(process, false, 0);
-
- sdk.setCachedCurrentTarget(targetToSelect);
-
- return true;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -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
- *******************************************************************************/
-
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.process.*;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-import java.io.ByteArrayOutputStream;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Invoke 'sb2-show path' on a list of paths and return the mappings, or <code>null</code>
- * for unmapped entries
- * @author eswartz
- *
- */
-public class ShowPathMappingSb2Command extends ScratchboxCommand {
- public ShowPathMappingSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return true;
- }
-
- public Map<IPath, IPath> performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- List<String> cmdLine = CommandLineArguments.createFromVarArgs(
- commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_COMMAND),
- commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_ACTION));
- cmdLine.addAll(params);
-
- IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(
- commandAbstractor.getProcessLauncherFactory(),
- null, cmdLine);
-
- /*Process process =*/ launcher.createProcess();
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ByteArrayOutputStream err = new ByteArrayOutputStream();
- launcher.waitAndRead(out, err);
-
- if (err.size() != 0)
- throw new ScratchboxException("Cannot resolve scratchbox2 path mappings:\n"+ err);
-
- String resolveInfo = out.toString().trim();
- String[] lines = resolveInfo.split("\r\n|\r|\n");
-
- Map<IPath, IPath> result = new HashMap<IPath, IPath>(lines.length);
-
- Pattern sb2ShowPattern = Pattern.compile(
- commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_OUTPUT_PATTERN));
-
- for (String line : lines) {
- Matcher matcher = sb2ShowPattern.matcher(line);
- if (matcher.matches()) {
- String toPath = matcher.group(2);
- // workaround buggy output
- if (toPath.startsWith("//"))
- toPath = toPath.substring(1);
- result.put(new Path(matcher.group(1)), new Path(toPath));
- }
- }
-
- return result;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,97 +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)
- *******************************************************************************/
-package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTarget;
-
-import java.util.*;
-
-/**
- * Show the settings of a Scratchbox target.
- * This command wraps the callback to service sb-conf show [<TARGET>]
- *
- */
-public class ShowTargetCommand extends ScratchboxCommand {
-
- public ShowTargetCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.maemo.esbox.core.internal.command.ICommand#performCommand(java.util.List)
- */
- public ScratchboxTarget performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(params))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction = commandAbstractor.getPreferenceValue(
- SB1PreferenceConstants.SB1_SHOW_ACT);
- String showTargetCommandString = this.replaceScratchboxConfigCommand(
- listAction, new String[] { params.get(0) });
-
- Process process = createProcess(showTargetCommandString, null);
-
- ScratchboxTarget target = null;
- List<String> targetInfo = getLineInputFromProcessAndWait(process, false, 0);
- target = createTarget(params.get(0), targetInfo);
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.maemo.esbox.core.scratchbox.internal.command.ScratchboxCommand#getParametersSize()
- */
- @Override
- public int getParametersSize() {
- // TODO Auto-generated method stub
- return 1;
- }
-
- private ScratchboxTarget createTarget(String targetName,
- List<String> targetInfo) {
- ScratchboxTarget target = new ScratchboxTarget();
-
- target.setName(targetName);
-
- String compilerField = targetInfo.get(0);
- String compiler = compilerField.substring(
- compilerField.indexOf(":") + 1).trim();
- target.setCompiler(compiler);
-
- String devkitsField = targetInfo.get(1);
- devkitsField = devkitsField.substring(devkitsField.indexOf(":") + 1);
- StringTokenizer tokens = new StringTokenizer(devkitsField);
- List<String> devkits = new ArrayList<String>();
- while (tokens.hasMoreTokens()) {
- devkits.add(tokens.nextToken());
- }
- target.setDevkits(devkits);
-
- String cputranspField = targetInfo.get(2);
- String cpuTransp = cputranspField.substring(
- cputranspField.indexOf(":") + 1).trim();
- target.setCputransp(cpuTransp);
-
- return target;
- }
-
-}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,7 +14,9 @@
import org.maemo.esbox.core.*;
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.ProcessLauncherCreator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import java.util.List;
@@ -26,7 +28,7 @@
public class SimpleCommand extends ScratchboxCommand {
public SimpleCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,10 +12,10 @@
package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import java.util.List;
@@ -27,7 +27,7 @@
public class AddSbrshCommand extends ScratchboxCommand {
public AddSbrshCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,10 +12,10 @@
package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import java.util.List;
@@ -28,7 +28,7 @@
public class ConfigureSbrshCommand extends ScratchboxCommand {
public ConfigureSbrshCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,10 +12,10 @@
package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import java.util.List;
@@ -27,7 +27,7 @@
public class MountTargetSbrshCommand extends ScratchboxCommand {
public MountTargetSbrshCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,10 +12,10 @@
package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import java.util.List;
@@ -27,7 +27,7 @@
public class UnmountTargetSbrshCommand extends ScratchboxCommand {
public UnmountTargetSbrshCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -18,7 +18,7 @@
import org.maemo.esbox.core.machine.IMachine;
import org.maemo.esbox.core.sdk.IPreferenceProvider;
import org.maemo.esbox.internal.api.core.sdk.BaseSDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB1PreferenceConstants.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB1PreferenceConstants.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB1PreferenceConstants.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,75 +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.maemosdk.core;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-
-/**
- * This class encapsulates the keys for preference constants defined by Scratchbox 1.
- * @author eswartz
- *
- */
-public class SB1PreferenceConstants {
- public static final int VERSION_MAJOR = 17;
- public static final int VERSION_MINOR = 0;
-
- /** Get the preference store that contains these preferences */
- public static IPreferenceStore getPreferenceStore() {
- return Activator.getDefault().getPreferenceStore();
- }
-
-
- /* SB1 configuration options */
-
- public static final String RUN_SCRIPT_LOC = "RUN_SCRIPT_LOC";
-
- public static final String SB1_GDB_REMOTE_QEMU = "SB1_GDB_REMOTE_QEMU";
- public static final String SB1_CURRENT_ACT = "SB1_CURRENT_ACT";
- public static final String SB1_SBOX_COMMAND = "SB1_SBOX_COMMAND";
- public static final String SB1_REMOVE_ACT = "SB1_REMOVE_ACT";
- public static final String SB1_REMOVE_OPT_FORCE = "SB1_REMOVE_OPT_FORCE";
- public static final String SB1_RESET_ACT = "SB1_RESET_ACT";
- public static final String SB1_ROOTSTRAP_ACT = "SB1_ROOTSTRAP_ACT";
- public static final String SB1_ROOTSTRAP_OPT_FORCE = "SB1_ROOTSTRAP_OPT_FORCE";
- public static final String SB1_INSTALL_ACT = "SB1_INSTALL_ACT";
- public static final String SB1_INSTALL_OPT_CLIB = "SB1_INSTALL_OPT_CLIB";
- public static final String SB1_INSTALL_OPT_DEVKITS = "SB1_INSTALL_OPT_DEVKITS";
- public static final String SB1_INSTALL_OPT_ETC = "SB1_INSTALL_OPT_ETC";
- public static final String SB1_INSTALL_OPT_FAKE = "SB1_INSTALL_OPT_FAKE";
- public static final String SB1_INSTALL_OPT_GDB = "SB1_INSTALL_OPT_GDB";
- public static final String SB1_INSTALL_OPT_STRACE = "SB1_INSTALL_OPT_STRACE";
- public static final String SB1_KILLALL_ACT = "SB1_KILLALL_ACT";
- public static final String SB1_KILLALL_OPT_SIGNAL = "SB1_KILLALL_OPT_SIGNAL";
- public static final String SB1_LIST_ACT = "SB1_LIST_ACT";
- public static final String SB1_LIST_OPT_COMPILERS = "SB1_LIST_OPT_COMPILERS";
- public static final String SB1_LIST_OPT_CPU = "SB1_LIST_OPT_CPU";
- public static final String SB1_LIST_OPT_DEVKITS = "SB1_LIST_OPT_DEVKITS";
- public static final String SB1_LIST_OPT_SESSIONS = "SB1_LIST_OPT_SESSIONS";
- public static final String SB1_LIST_OPT_TARGETS = "SB1_LIST_OPT_TARGETS";
- public static final String SB1_LOGIN_COMMAND = "SB1_LOGIN_COMMAND";
- public static final String SB1_SBOX_SANDBOX = "SB1_SBOX_SANDBOX";
- public static final String SB1_SELECT_ACT = "SB1_SELECT_ACT";
- public static final String SB1_SETUP_ACT = "SB1_SETUP_ACT";
- public static final String SB1_SETUP_OPT_COMPILER = "SB1_SETUP_OPT_COMPILER";
- public static final String SB1_SETUP_OPT_CPUTRANSP = "SB1_SETUP_OPT_CPUTRANSP";
- public static final String SB1_SETUP_OPT_DEVKITS = "SB1_SETUP_OPT_DEVKITS";
- public static final String SB1_SETUP_OPT_FORCE = "SB1_SETUP_OPT_FORCE";
- public static final String SB1_SHOW_ACT = "SB1_SHOW_ACT";
- public static final String SB1_SHOW_OPT_COMP_ARCH = "SB1_SHOW_OPT_COMP_ARCH";
- public static final String SB1_SHOW_OPT_COMP_CLIB = "SB1_SHOW_OPT_COMP_CLIB";
- public static final String SB1_SHOW_OPT_COMP_SUBARCH = "SB1_SHOW_OPT_COMP_SUBARCH";
- public static final String SB1_SHOW_OPT_COMPILERS = "SB1_SHOW_OPT_COMPILERS";
- public static final String SB1_SHOW_OPT_CPU = "SB1_SHOW_OPT_CPU";
- public static final String SB1_SHOW_OPT_DEVKITS = "SB1_SHOW_OPT_DEVKITS";
- public static final String SB1_VERSION_ACT = "SB1_VERSION_ACT";
-}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB2PreferenceConstants.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB2PreferenceConstants.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/SB2PreferenceConstants.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,55 +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.maemosdk.core;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-
-/**
- * This class encapsulates the keys for preference constants defined by Scratchbox 2.
- * @author eswartz
- *
- */
-public class SB2PreferenceConstants {
- public static final int VERSION_MAJOR = 17;
- public static final int VERSION_MINOR = 0;
-
- /** Get the preference store that contains these preferences */
- public static IPreferenceStore getPreferenceStore() {
- return Activator.getDefault().getPreferenceStore();
- }
-
-
- /* SB2 configuration options */
- public static final String SB2_GDB_REMOTE_QEMU = "SB2_GDB_REMOTE_QEMU";
- public static final String SB2_CONFIG_COMMAND = "SB2_CONFIG_COMMAND";
- public static final String SB2_EXEC_COMMAND = "SB2_EXEC_COMMAND";
- public static final String SB2_INIT_COMMAND = "SB2_INIT_COMMAND";
- public static final String SB2_VERSION_ACT = "SB2_VERSION_ACT";
- public static final String SB2_LIST_ACT = "SB2_LIST_ACT";
- public static final String SB2_MAPPING_MODE = "SB2_MAPPING_MODE";
- public static final String SB2_INSTALL_MAPPING_MODE = "SB2_INSTALL_MAPPING_MODE";
- public static final String SB2_LOG_LEVEL = "SB2_LOG_LEVEL";
- public static final String SB2_INIT_OPT_COMPILER = "SB2_INIT_OPT_COMPILER";
- public static final String SB2_MAEMO_ROOTSTRAP_COMMAND = "SB2_MAEMO_ROOTSTRAP_COMMAND";
- public static final String SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT = "SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT";
- public static final String SB2_MAEMO_ROOTSTRAP_LIST_ACT = "SB2_MAEMO_ROOTSTRAP_LIST_ACT";
- public static final String SB2_MAEMO_ROOTSTRAP_INSTALL_ACT = "SB2_MAEMO_ROOTSTRAP_INSTALL_ACT";
- public static final String SB2_MAEMO_ROOTSTRAP_FORCE_OPT = "SB2_MAEMO_ROOTSTRAP_FORCE_OPT";
- public static final String SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT = "SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT";
- public static final String SB2_MAEMO_ROOTSTRAP_REMOVE_ACT = "SB2_MAEMO_ROOTSTRAP_REMOVE_ACT";
- public static final String SB2_SB2_SHOW_COMMAND = "SB2_SB2_SHOW_COMMAND";
- public static final String SB2_SB2_SHOW_PATH_ACTION = "SB2_SB2_SHOW_PATH_ACTION";
- public static final String SB2_SB2_SHOW_PATH_OUTPUT_PATTERN = "SB2_SB2_SHOW_PATH_OUTPUT_PATTERN";
- public static final String SB2_MAEMO_ROOTSTRAP_PATH_ACT = "SB2_MAEMO_ROOTSTRAP_PATH_ACT";
-
-}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/AbstractSDKCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/AbstractSDKCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/AbstractSDKCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,57 @@
+package org.maemo.esbox.maemosdk.core.command;
+
+import java.security.InvalidParameterException;
+
+
+public abstract class AbstractSDKCommand extends ScratchboxCommand {
+
+ public AbstractSDKCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * Replace the actions and options of the Scratchbox configure command. This
+ * is an utility method to be used by all the subclasses of
+ * IScratchboxCommand.
+ *
+ * @param sboxCommand
+ * The Scratchbox command.
+ * @param action
+ * The action to be replace.
+ * @return The result command with the replacement of action made.
+ */
+ public String replaceScratchboxConfigCommand(String action) {
+ return this.replaceScratchboxConfigCommand(action, null);
+ }
+
+ /**
+ * Replace the actions and options of the Scratchbox configure command. This
+ * is an utility method to be used by all the subclasses of
+ * IScratchboxCommand.
+ *
+ * @param action
+ * The action to be replace.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ *
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ public abstract String replaceScratchboxConfigCommand(String action, String[] options)throws InvalidParameterException;
+// {
+// String sboxCommand;
+//
+// if (sboxVersion == 1)
+// sboxCommand = commandAbstractor.getPreferenceValue(
+// SB1PreferenceConstants.SB1_SBOX_COMMAND);
+// else
+// sboxCommand = commandAbstractor.getPreferenceValue(
+// SB2PreferenceConstants.SB2_CONFIG_COMMAND);
+//
+// return replaceScratchboxCommand(sboxCommand, action, options);
+// }
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ICommandAbstractor.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ICommandAbstractor.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ICommandAbstractor.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.maemosdk.core.command;
+
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+/**
+ * This interface is used to abstract the way an ICommand is constructed
+ * and launched, and the means by which it gets the values to substitute into
+ * commands. It may, for instance, either be run in the context of an ISDKTarget,
+ * ISDK, or run natively. Similarly, it may be controlled entirely by unit tests.
+ *
+ * @author eswartz
+ *
+ */
+public interface ICommandAbstractor {
+
+ /**
+ * Read a preference for the implicit category of the abstractor.
+ * @param key the key to search
+ * @return preference value or "" if undefined
+ */
+ String getPreferenceValue(String key);
+
+ /**
+ * Get the factory for creating process launchers to run programs in the context of the SDK.
+ * @return the process launcher factory, never <code>null</code>
+ */
+ IProcessLauncherFactory getProcessLauncherFactory();
+
+ /**
+ * Get the file system access for the filesystem used by the command
+ * @return IFilesystemAccess, never <code>null</code>
+ */
+ IFileSystemAccess getFileSystemAccess();
+}
\ No newline at end of file
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,535 @@
+/*******************************************************************************
+ * 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.maemosdk.core.command;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidOperationException;
+import org.maemo.esbox.maemosdk.core.*;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.io.*;
+import java.security.InvalidParameterException;
+import java.util.*;
+
+/**
+ * Implements some common methods for Scratchbox commands.
+ * <p>
+ * <b>NOTE:</b> this base class should only be used for basic scratchbox utility
+ * command launching. It is not recommended to use this class's
+ * string-substitution method to create general command lines, since this
+ * ignores details like shell escaping and quoting, which should be
+ * constructed with the List<String> class and alternate IProcessLauncherFactory
+ * methods.
+ */
+public abstract class ScratchboxCommand implements ICommand {
+
+ /**
+ *
+ */
+ private static final IStatus CANCEL_STATUS = Policy.getCancelStatus(Activator.getDefault());
+
+ public static final String ERROR_TOKEN = "ERROR:"; //$NON-NLS-1$
+
+ public static final String WARNING_TOKEN = "sb-conf:"; //$NON-NLS-1$
+
+ protected ICommandAbstractor commandAbstractor;
+
+// protected int sboxVersion;
+
+ protected MessageConsole console;
+
+ private IProgressMonitor monitor;
+
+ public ScratchboxCommand(ICommandAbstractor commandAbstractor/*, int sboxVersion*/) {
+ this.commandAbstractor = commandAbstractor;
+// this.sboxVersion = sboxVersion;
+ }
+
+
+
+ /**
+ * Replace the actions and options of the sbrsh configure command.
+ *
+ * @param action
+ * The action to be replace.
+ * @return The result command with the replacement of action made.
+ */
+ public String replaceScratchboxSbrshConfigCommand(String action) {
+ return this.replaceScratchboxSbrshConfigCommand(action, null);
+ }
+
+ /**
+ * Replace the actions and options of the sbrsh configure command.
+ *
+ * @param action
+ * The action to be replace.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ *
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ public String replaceScratchboxSbrshConfigCommand(String action,
+ String[] options) throws InvalidParameterException {
+ String sbrshConfigCommand = commandAbstractor.getPreferenceValue(
+ MaemoPreferenceConstants.SBRSH_CONFIG_COMMAND);
+
+ return replaceScratchboxCommand(sbrshConfigCommand, action, options);
+ }
+
+ /**
+ * Replace the actions and options of a given Scratchbox command.
+ *
+ * @param command
+ * The command with actions and options to be replaced.
+ * @param action
+ * The action to be replaced.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ protected String replaceScratchboxCommand(String command, String action,
+ String[] options) throws InvalidParameterException {
+ if (command == null || action == null)
+ throw new InvalidParameterException("The parameters cannot be null");
+
+ String resultCommand;
+ String optionsToReplace = "";
+ String separator = "";
+
+ if (options != null) {
+ for (int i = 0; i < options.length; i++) {
+ optionsToReplace += separator + options[i];
+ separator = " ";
+ }
+ }
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("ACTIONS", action);
+ substitutor.define("OPTIONS", optionsToReplace);
+
+ resultCommand = substitutor.substitute(command);
+
+ return resultCommand;
+ }
+
+ /**
+ * For long-running process, provide a progress monitor and
+ * the console to which to report results of an executing command.
+ * If not set, or set to <code>null</code>, there will be no console output.
+ * @param monitor
+ * @param console
+ */
+ protected void setMonitorAndConsole(IProgressMonitor monitor, MessageConsole console) {
+ this.monitor = monitor;
+ this.console = console;
+ }
+
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param launcherFactory the factory for creating IProcessLauncherFactory
+ * @param commandLine the command line string
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(List<String> cmdLine) throws ESboxException {
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ cmdLine);
+ Process process = processLauncher.createProcess();
+ if (console != null) {
+ new PrintStream(console.newMessageStream()).println(CommandLineArguments.toCommandLine(cmdLine));
+ processLauncher.redirectToConsole(console);
+ }
+ return process;
+ }
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param launcherFactory the factory for creating IProcessLauncherFactory
+ * @param commandLine the command line string
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(String commandline) throws ESboxException {
+ return createProcess(commandline, null);
+ }
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param commandLine the command line string
+ * @param envBlock prperties
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(String commandline, IEnvironmentModifierBlock envBlock) throws ESboxException {
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(commandline);
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ cmdLine,
+ envBlock);
+ Process process = processLauncher.createProcess();
+ if (console != null) {
+ new PrintStream(console.newMessageStream()).println(commandline);
+ processLauncher.redirectToConsole(console);
+ }
+ return process;
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Optionally check whether stderr is empty.
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @return stdout results, as a string
+ */
+ protected String getInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
+ return getInputFromProcessAndWait(process, allowError, 0);
+ }
+
+ protected IStatus runAndWaitForProcess(String jobName, final String commandline,
+ IEnvironmentModifierBlock envBlock, long timeout) throws ESboxException {
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ CommandLineArguments.createFromCommandLine(commandline),
+ envBlock);
+ processLauncher.usePTY(true);
+
+ final Process process = processLauncher.createProcess();
+ new PrintStream(console.newMessageStream()).println(commandline);
+
+ Job job = new Job(jobName) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("", 2);
+ monitor.subTask("Running " + commandline);
+ try {
+ processLauncher.redirectToConsole(console);
+ try {
+ process.waitFor();
+ monitor.worked(1);
+ int exit = process.exitValue();
+ if (exit != 0) {
+ return Activator.createErrorStatus("Process failed with exit value " + exit, null);
+ }
+ } catch (InterruptedException e) {
+ return CANCEL_STATUS;
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ try {
+ long deadline = System.currentTimeMillis() + timeout;
+ while (job.getResult() == null) {
+ Thread.sleep(500);
+ if (monitor.isCanceled() || (timeout != 0 && System.currentTimeMillis() >= deadline)) {
+ process.destroy();
+ job.cancel();
+ return CANCEL_STATUS;
+ }
+ }
+ return job.getResult();
+ } catch (InterruptedException e) {
+ return CANCEL_STATUS;
+ }
+ }
+
+ /**
+ * Wait for the process to finish with a certain timeout.
+ * @param timeout if not zero, timeout in milliseconds before throwing exception
+ * @return exit code
+ */
+ protected int waitForProcess(final Process process, final long timeout) throws ScratchboxException {
+ final Exception[] excs = { null };
+ Runnable runnable = new Runnable() {
+
+ public void run() {
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ };
+
+ if (timeout == 0) {
+ runnable.run();
+ } else {
+ Thread thread = new Thread(runnable);
+ thread.start();
+ try {
+ thread.join(timeout);
+ if (thread.isAlive()) {
+ thread.interrupt();
+ excs[0] = new InterruptedException();
+ }
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ if (excs[0] instanceof InterruptedException) {
+ throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
+ } else if (excs[0] instanceof ScratchboxException) {
+ throw (ScratchboxException) excs[0];
+ } else if (excs[0] != null) {
+ throw new ScratchboxException(excs[0]);
+ }
+
+ return process.exitValue();
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Optionally check whether stderr is empty.
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @param timeout if not zero, timeout in milliseconds before throwing exception
+ * @return stdout results, as a string
+ */
+ protected String getInputFromProcessAndWait(final Process process, final boolean allowError, final long timeout) throws ScratchboxException {
+ final String[] inputs = { null };
+ final Exception[] excs = { null };
+ Runnable runnable = new Runnable() {
+
+ public void run() {
+ try {
+ inputs[0] = getInputFromProcess(process);
+
+ if (!allowError) {
+ String error = getErrorInputFromProcess(process);
+ if (error.length() > 0) {
+ excs[0] = new ScratchboxInvalidOperationException(error);
+ return;
+ }
+ }
+ } catch (IOException e) {
+ excs[0] = e;
+ return;
+ } catch (ScratchboxException e) {
+ excs[0] = e;
+ return;
+ }
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ };
+
+ if (timeout == 0) {
+ runnable.run();
+ } else {
+ Thread thread = new Thread(runnable);
+ thread.start();
+ try {
+ thread.join(timeout);
+ if (thread.isAlive()) {
+ thread.interrupt();
+ process.destroy();
+ excs[0] = new InterruptedException();
+ }
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ if (excs[0] instanceof InterruptedException) {
+ throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
+ } else if (excs[0] instanceof ScratchboxException) {
+ throw (ScratchboxException) excs[0];
+ } else if (excs[0] != null) {
+ throw new ScratchboxException(excs[0]);
+ }
+
+ return inputs[0];
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Return a
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @return stdout results, as an array of lines
+ */
+ protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
+ return getLineInputFromProcessAndWait(process, allowError, 0);
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Return a
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @param timeout if non-zero, timeout in milliseconds
+ * @return stdout results, as an array of lines
+ */
+ protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError, long timeout) throws ScratchboxException {
+ String input = getInputFromProcessAndWait(process, allowError, timeout);
+ return processLines(input);
+ }
+
+ /**
+ * Return the input stream of the process as a string. All lines generated
+ * by the process are concatenated.
+ *
+ * @param process
+ * the process.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ */
+ private String getInputFromProcess(Process process) throws IOException, ScratchboxException {
+ return getInputStream(process.getInputStream());
+ }
+
+ /**
+ * Return the error input stream of the process as a string. All lines
+ * generated by the process are concatenated.
+ *
+ * @param process
+ * the process.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ * @throws ScratchboxException
+ */
+ private String getErrorInputFromProcess(Process process) throws IOException, ScratchboxException {
+ return getInputStream(process.getErrorStream());
+ }
+
+ /**
+ * Return an input stream as a string. All lines generated by the process
+ * are concatenated.
+ *
+ * @param processInputStream
+ * the input stream to be read.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ * @throws ScratchboxException
+ */
+ private String getInputStream(InputStream processInputStream)
+ throws IOException, ScratchboxException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ processInputStream));
+
+ String line;
+ String result = "";
+ String separator = "";
+
+ while ((line = in.readLine()) != null) {
+ checkError(line,ERROR_TOKEN);
+ checkError(line,WARNING_TOKEN);
+ result += separator + line;
+ separator = System.getProperty("line.separator");
+ }
+
+ return result;
+ }
+
+ private void checkError(String inputString, String errorPattern) throws ScratchboxException {
+ if (inputString.startsWith(errorPattern)) {
+ int index = inputString.indexOf(errorPattern);
+ throw new ScratchboxException(inputString.substring(index + errorPattern.length()));
+ }
+ }
+
+ /**
+ * Get a string with a set of lines an return a list with the lines
+ * separated.
+ *
+ * @param stringWithLines
+ * a string with lines.
+ * @return a list with the lines separated.
+ */
+ private List<String> processLines(String stringWithLines) {
+ List<String> lines = new ArrayList<String>();
+ final String FILE_SEPARATOR = System.getProperty("line.separator");
+
+ StringTokenizer tokens = new StringTokenizer(stringWithLines,
+ FILE_SEPARATOR);
+ while (tokens.hasMoreElements()) {
+ lines.add(tokens.nextToken());
+ }
+
+ return lines;
+ }
+
+ /**
+ * Return the correct size of performCommand parameters list.
+ *
+ * @return the correct size of performCommand parameters list.
+ */
+ public abstract int getParametersSize();
+
+ /**
+ * Verify if the parameter list has the correct size.
+ *
+ * @param param
+ * the list of parameters to be verified.
+ * @return true, if the list contains the correct number of parameters;
+ * false, otherwise.
+ */
+ protected boolean checkParameters(List<String> param) {
+ return getParametersSize() == param.size();
+ }
+
+
+ protected String catenateLines(List<String> lines) {
+ StringBuilder builder = new StringBuilder();
+ for (String line : lines) {
+ builder.append(line);
+ builder.append('\n');
+ }
+ return builder.toString();
+ }
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxInvalidParameterException.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxInvalidParameterException.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/command/ScratchboxInvalidParameterException.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.maemosdk.core.command;
+
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This exception is thrown whenever an invalid parameter is passed to a command.
+ */
+public class ScratchboxInvalidParameterException extends ScratchboxException {
+
+ /**
+ * Serial version number of exception.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * the message associated with the exception.
+ */
+ public ScratchboxInvalidParameterException(String message) {
+ super(message);
+ }
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -21,6 +21,7 @@
import org.maemo.esbox.core.machine.ProcessFilterCmdLineRegexp;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.MaemoUtils;
/**
* This class maintains knowledge about whether maemo is running in
@@ -77,7 +78,7 @@
if (isMaemoRunning(sdkTarget))
throw new ScratchboxException("Maemo is already running");
- AbstractScratchboxSDK.startMaemoCommand(sdkTarget);
+ MaemoUtils.startMaemoCommand(sdkTarget);
}
@@ -92,7 +93,7 @@
//if (!isMaemoRunning(sdkTarget))
// throw new ScratchboxException("Maemo is not running, or failed to launch.");
- AbstractScratchboxSDK.stopMaemoCommand(sdkTarget);
+ MaemoUtils.stopMaemoCommand(sdkTarget);
}
/**
@@ -101,7 +102,7 @@
* @throws ESboxException if cannot be restarted
*/
public void restartMaemo(ISDKTarget sdkTarget) throws ESboxException {
- AbstractScratchboxSDK.restartMaemoCommand(sdkTarget);
+ MaemoUtils.restartMaemoCommand(sdkTarget);
}
/**
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDK.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDK.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDK.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -4,56 +4,68 @@
import java.util.List;
import java.util.Properties;
-import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.maemo.esbox.core.CorePreferenceManager;
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
import org.maemo.esbox.core.machine.IFileSystemAccess;
import org.maemo.esbox.core.machine.ILocalMachine;
import org.maemo.esbox.core.machine.IMachine;
-import org.maemo.esbox.core.machine.MachineManager;
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.IProcessLauncherFactory;
import org.maemo.esbox.core.process.ProcessLauncherUtils;
import org.maemo.esbox.core.sdk.IPreferenceProvider;
-import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.machine.HostUnixMachine;
import org.maemo.esbox.internal.api.core.sdk.BaseSDK;
-import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.MaemoCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh.AddSbrshCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh.ConfigureSbrshCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh.MountTargetSbrshCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh.UnmountTargetSbrshCommand;
import org.maemo.esbox.internal.maemosdk.core.sdk.IScratchboxSDKPlatformArchitectureProvider;
-import org.maemo.esbox.maemosdk.core.scratchbox.PersistentCache;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
public abstract class AbstractScratchboxSDK extends BaseSDK implements IScratchboxSDK, IScratchboxSDKPlatformArchitectureProvider {
protected IPreferenceProvider prefProvider=null;
- //cache
- private static boolean useCaching;
- private static PersistentCache cache;
+ protected final String NAME; //$NON-NLS-1$
+ /** String for URI of machine where we detected scratchbox VERSION */
+ protected final String SB_MACHINE;
+ /** String for scratchbox VERSION version or <code>null</code> */
+ protected final String SB_VERSION;
+ /** String[] scratchbox VERSION target name array */
+ protected final String SB_TARGETS;
+ protected final int VERSION_NUMBER;
+
+
+
protected final static List<String> EMPTY_ARGS = new ArrayList<String>();
- public AbstractScratchboxSDK(IMachine machine, String version, String name)
+ public AbstractScratchboxSDK(
+ IMachine machine,
+ String version,
+ String name,
+ String sb_machine,
+ String sb_version,
+ String sb_targets,
+ int versionNumber)
{
super(machine, version, name);
+ NAME=name;
+ SB_MACHINE = sb_machine;
+ SB_VERSION = sb_version;
+ SB_TARGETS = sb_targets;
+ VERSION_NUMBER = versionNumber;
}
private String cachedCurrentTarget;
+ public int getSboxVersion() {
+ return VERSION_NUMBER;
+ }
-
public String getMainVersion() {
String version = getVersion();
int dotIndex = version.indexOf('.');
@@ -89,7 +101,7 @@
}
public ICommandAbstractor getCommandAbstractor() throws ESboxException {
- acquireMachine(this.getMachine());
+ MachineUtils.acquireMachine(this.getMachine());
ICommandAbstractor commandAbstractor = new ICommandAbstractor() {
@@ -160,138 +172,20 @@
}
- public static ICommandAbstractor getCommandAbstractor(final ISDKTarget sdkTarget) throws ESboxException {
- // ensure machine is alive
- acquireMachine(sdkTarget.getSDK().getMachine());
-
- return new ICommandAbstractor() {
-
- public String getPreferenceValue(String key) {
- return sdkTarget.getPreferenceValue(key);
- }
-
- public IProcessLauncherFactory getProcessLauncherFactory() {
- return sdkTarget.getProcessLauncherFactory();
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
- */
- public IFileSystemAccess getFileSystemAccess() {
- return sdkTarget.getTargetFileSystemAccess();
- }
- };
- }
- /** Get a command abstractor for the host. */
- public static ICommandAbstractor getHostCommandAbstractor(final IMachine machine) throws ESboxException {
- // ensure machine is alive
- acquireMachine(machine);
+
- return new ICommandAbstractor() {
-
- public String getPreferenceValue(String key) {
- return new UserAwarePreferenceProviderWrapper(
- CorePreferenceManager.getInstance().getPreferenceProvider(),
- machine).getPreferenceValue(key);
- }
-
- public IProcessLauncherFactory getProcessLauncherFactory() {
- return machine.getProcessLauncherFactory();
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
- */
- public IFileSystemAccess getFileSystemAccess() {
- return machine.getFileSystemAccess();
- }
- };
- }
- public static synchronized void clearCachedData() {
- if (useCaching) {
- cache.clear();
- }
- }
- public static synchronized void saveCachedData() {
- if (useCaching) {
- cache.save();
- }
- }
- /**
- * Start maemo. This runs synchronously.
- *
- * @param sdkTarget
- * @return
- * @throws ESboxException
- */
- public static synchronized boolean startMaemoCommand(ISDKTarget sdkTarget)
- throws ESboxException {
- MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
- return (Boolean) maemoCommand.startMaemoCommand(sdkTarget);
- }
- /**
- * Restart maemo. This runs synchronously.
- *
- * @return
- * @throws ESboxException
- */
- public static synchronized boolean restartMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
- MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
- return (Boolean) maemoCommand.restartMaemoCommand(sdkTarget);
- }
-
- /**
- * Stop maemo. This runs synchronously.
- * @return
- * @throws ESboxException
- */
- public static synchronized boolean stopMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
- MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
- return (Boolean) maemoCommand.stopMaemoCommand(sdkTarget);
- }
- // protected
- protected static void acquireMachine(final IMachine machine) throws ESboxException {
- if (!machine.isAlive()) {
- IStatus status = MachineManager.getInstance().acquireMachine(machine, null);
- if (!status.isOK()) {
- ESboxException e = new ESboxException(status.getMessage(), status.getException());
- Activator.getErrorLogger().logError("Failed to launch machine for scratchbox command",
- e);
- throw e;
- }
- }
- }
- protected static void setCachedValue(String key, Object value) {
- if (useCaching)
- cache.set(key, value);
- }
- protected static void ensureCurrentMachine(String machineKey, IMachine machine) {
- String current = (String) getCachedValue(machineKey);
- if (current != null) {
- String machineURI = machine.getURI().toString();
- if (!current.equals(machineURI)) {
- // just zap
- clearCachedData();
- }
- setCachedValue(machineKey, machineURI);
- }
- }
- protected static Object getCachedValue(String key) {
- if (useCaching)
- return cache.get(key);
- else
- return null;
- }
+
+
/**
* For launching commands on the SDK's machine in order to control the machine, ensure
* we can access the tools for that SDK.
@@ -306,7 +200,7 @@
IMachine machine,
final String identifyingTool,
final String toolsPath) {
- if (areToolsOnPath(machine, identifyingTool)) {
+ if (MachineUtils.areToolsOnPath(machine, identifyingTool)) {
return commandAbstractor;
}
@@ -358,24 +252,5 @@
};
}
- private static boolean areToolsOnPath(IMachine machine, String identifyingTool) {
- boolean toolsOnPath = false;
- Properties env = machine.getStandardEnvironment();
- String pathVar = env.getProperty("PATH");
- if (pathVar == null) {
- toolsOnPath = false; // assume not!
- } else {
- String[] pathEntries = pathVar.split(":");
- for (String pathEntry : pathEntries) {
- IPath path = new Path(pathEntry).append(identifyingTool);
- IFileInfo info = machine.getFileSystemAccess().getFileStore(path).fetchInfo();
- if (info.exists()) {
- toolsOnPath = true;
- break;
- }
- }
-
- }
- return toolsOnPath;
- }
+
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDKTarget.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDKTarget.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/AbstractScratchboxSDKTarget.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -9,7 +9,7 @@
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.sdk.BaseSDKTarget;
import org.maemo.esbox.internal.maemosdk.core.adapters.MaemoRunStandaloneSupportAdapterFactory;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
public abstract class AbstractScratchboxSDKTarget extends BaseSDKTarget implements
IScratchboxSDKTarget {
@@ -26,7 +26,7 @@
* within the context of scratchbox. */
public ICommandAbstractor getCommandAbstractor() throws ESboxException {
// ensure machine is alive
- AbstractScratchboxSDK.acquireMachine(this.getSDK().getMachine());
+ MachineUtils.acquireMachine(this.getSDK().getMachine());
return new ICommandAbstractor() {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,7 +14,7 @@
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
/**
* This interface provides scratchbox-specific functionality to an ISDK
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,7 +14,7 @@
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.process.IProcessLauncherFactory;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
/**
* This interface provides scratchbox-specific functionality to an ISDKTarget.
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MachineUtils.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MachineUtils.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MachineUtils.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,91 @@
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import java.util.Properties;
+
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.CorePreferenceManager;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineManager;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+
+public class MachineUtils {
+
+ /** Get a command abstractor for the host. */
+ public static ICommandAbstractor getHostCommandAbstractor(final IMachine machine) throws ESboxException {
+ // ensure machine is alive
+ acquireMachine(machine);
+
+ return new ICommandAbstractor() {
+
+ public String getPreferenceValue(String key) {
+ return new UserAwarePreferenceProviderWrapper(
+ CorePreferenceManager.getInstance().getPreferenceProvider(),
+ machine).getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return machine.getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return machine.getFileSystemAccess();
+ }
+ };
+ }
+
+ public static void acquireMachine(final IMachine machine) throws ESboxException {
+ if (!machine.isAlive()) {
+ IStatus status = MachineManager.getInstance().acquireMachine(machine, null);
+ if (!status.isOK()) {
+ ESboxException e = new ESboxException(status.getMessage(), status.getException());
+ Activator.getErrorLogger().logError("Failed to launch machine for scratchbox command",
+ e);
+ throw e;
+ }
+ }
+ }
+
+ public static void ensureCurrentMachine(String machineKey, IMachine machine) {
+ String current = (String) ScratchboxSDKUtils.getInstance().getCachedValue(machineKey);
+ if (current != null) {
+ String machineURI = machine.getURI().toString();
+ if (!current.equals(machineURI)) {
+ // just zap
+ ScratchboxSDKUtils.getInstance().clearCachedData();
+ }
+ ScratchboxSDKUtils.getInstance().setCachedValue(machineKey, machineURI);
+ }
+ }
+
+ public static boolean areToolsOnPath(IMachine machine, String identifyingTool) {
+ boolean toolsOnPath = false;
+ Properties env = machine.getStandardEnvironment();
+ String pathVar = env.getProperty("PATH");
+ if (pathVar == null) {
+ toolsOnPath = false; // assume not!
+ } else {
+ String[] pathEntries = pathVar.split(":");
+ for (String pathEntry : pathEntries) {
+ IPath path = new Path(pathEntry).append(identifyingTool);
+ IFileInfo info = machine.getFileSystemAccess().getFileStore(path).fetchInfo();
+ if (info.exists()) {
+ toolsOnPath = true;
+ break;
+ }
+ }
+
+ }
+ return toolsOnPath;
+ }
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MaemoUtils.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MaemoUtils.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/MaemoUtils.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,69 @@
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.MaemoCommand;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+
+public class MaemoUtils {
+
+ /**
+ * Start maemo. This runs synchronously.
+ *
+ * @param sdkTarget
+ * @return
+ * @throws ESboxException
+ */
+ public static synchronized boolean startMaemoCommand(ISDKTarget sdkTarget)
+ throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.startMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Restart maemo. This runs synchronously.
+ *
+ * @return
+ * @throws ESboxException
+ */
+ public static synchronized boolean restartMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.restartMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Stop maemo. This runs synchronously.
+ * @return
+ * @throws ESboxException
+ */
+ public static synchronized boolean stopMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.stopMaemoCommand(sdkTarget);
+ }
+
+ public static ICommandAbstractor getCommandAbstractor(final ISDKTarget sdkTarget) throws ESboxException {
+ // ensure machine is alive
+ MachineUtils.acquireMachine(sdkTarget.getSDK().getMachine());
+
+ return new ICommandAbstractor() {
+
+ public String getPreferenceValue(String key) {
+ return sdkTarget.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return sdkTarget.getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return sdkTarget.getTargetFileSystemAccess();
+ }
+ };
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -65,7 +65,8 @@
if( klass.isInstance(sdk))
result.add((SboxSDK)sdk);
}
- if(result.isEmpty()) throw new ScratchboxException("No "+klass.getName()+" installed");
+ if(result.isEmpty())
+ throw new ScratchboxException("No "+klass.getName()+" installed");
return result;
}
/**
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKUtils.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKUtils.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKUtils.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,46 @@
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import org.maemo.esbox.maemosdk.core.scratchbox.PersistentCache;
+
+public class ScratchboxSDKUtils {
+
+ //cache
+ private boolean useCaching;
+ private PersistentCache cache;
+
+ private static final ScratchboxSDKUtils INSTANCE=new ScratchboxSDKUtils();
+
+ protected ScratchboxSDKUtils(){
+ useCaching = true; //!GeneralUtils.isJUnitRunning();
+ cache = new PersistentCache();
+ cache.load();
+ }
+
+ public static synchronized ScratchboxSDKUtils getInstance(){
+ return INSTANCE;
+ }
+
+ public synchronized void clearCachedData() {
+ if (useCaching) {
+ cache.clear();
+ }
+ }
+
+ public synchronized void saveCachedData() {
+ if (useCaching) {
+ cache.save();
+ }
+ }
+
+ public void setCachedValue(String key, Object value) {
+ if (useCaching)
+ cache.set(key, value);
+ }
+
+ public Object getCachedValue(String key) {
+ if (useCaching)
+ return cache.get(key);
+ else
+ return null;
+ }
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/META-INF/MANIFEST.MF 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/META-INF/MANIFEST.MF 2008-10-10 08:01:46 UTC (rev 861)
@@ -11,6 +11,10 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: INdT / Nokia
-Export-Package: org.maemo.esbox.maemosdk.sdk1.command,
- org.maemo.esbox.maemosdk.sdk1.core,
- org.maemo.esbox.maemosdk.sdk1.provider
+Export-Package: org.maemo.esbox.maemosdk.sdk1.command;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.core;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.launcher;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.provider;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.ui.adapters;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.ui.preferences;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk1.ui.wizard;x-friends:="org.maemo.esbox.maemosdk.tests"
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/build.properties
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/build.properties 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/build.properties 2008-10-10 08:01:46 UTC (rev 861)
@@ -2,4 +2,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ conf/
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/conf/run.sh
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/conf/run.sh (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/conf/run.sh 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#/*******************************************************************************
+# * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia.
+# * 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 (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+# * Ed Swartz (Nokia) - additions and changes
+# *******************************************************************************/
+
+__version=0.5
+__release=1.2
+__location=$1
+__export_list=$2
+shift
+shift
+__command="$@"
+
+if [ ! -d $__location ] ; then
+ echo "E: Directory $__location not found"
+ exit 1
+fi
+
+cd $__location
+
+# apply exports and unsets
+if [ "$__export_list" != "-" ] ; then
+ IFS=,; for __export in $__export_list; do
+ case $__export in
+ -* ) unset `echo $__export | sed s/-//` ;;
+ * ) export $__export ;;
+ esac
+ done
+ IFS=" "
+fi
+
+# Run command
+$__command
+
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/plugin.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/plugin.xml 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/plugin.xml 2008-10-10 08:01:46 UTC (rev 861)
@@ -26,5 +26,15 @@
</adapter>
</factory>
</extension>
+ <extension
+ point="org.maemo.esbox.core.preference_set_provider">
+ <preferenceSetProvider
+ defaultsXMLFile="conf/sb1_prefs.xml"
+ preferenceConstantsClass="org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants"
+ preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
+ preferenceStoreBundle="org.maemo.esbox.maemosdk.sdk1"
+ version="17">
+ </preferenceSetProvider>
+ </extension>
</plugin>
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/Activator.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/Activator.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/Activator.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,8 +1,17 @@
package org.maemo.esbox.maemosdk.sdk1;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.maemo.esbox.core.ErrorLogger;
import org.osgi.framework.BundleContext;
@@ -17,6 +26,8 @@
// The shared instance
private static Activator plugin;
+ private IPreferenceStore preferenceStore;
+
/**
* The constructor
*/
@@ -83,5 +94,44 @@
return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+ /**
+ * Returns the preference store for this UI plug-in.
+ * This preference store is used to hold persistent settings for this plug-in in
+ * the context of a workbench. Some of these settings will be user controlled,
+ * whereas others may be internal setting that are never exposed to the user.
+ * <p>
+ * If an error occurs reading the preference store, an empty preference store is
+ * quietly created, initialized with defaults, and returned.
+ * </p>
+ * <p>
+ * <strong>NOTE:</strong> As of Eclipse 3.1 this method is
+ * no longer referring to the core runtime compatibility layer and so
+ * plug-ins relying on Plugin#initializeDefaultPreferences
+ * will have to access the compatibility layer themselves.
+ * </p>
+ *
+ * @return the preference store
+ */
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if (preferenceStore == null) {
+ preferenceStore = new ScopedPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
+
+ }
+ return preferenceStore;
+ }
}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/AbstractSDK1Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/AbstractSDK1Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/AbstractSDK1Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,25 @@
+package org.maemo.esbox.maemosdk.sdk1.command;
+
+import java.security.InvalidParameterException;
+
+import org.maemo.esbox.maemosdk.core.command.AbstractSDKCommand;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+public abstract class AbstractSDK1Command extends AbstractSDKCommand {
+
+ public AbstractSDK1Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ // TODO Auto-generated constructor stub
+ }
+
+ public String replaceScratchboxConfigCommand(String action, String[] options)throws InvalidParameterException {
+ String sboxCommand;
+
+ sboxCommand = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SBOX_COMMAND);
+
+ return replaceScratchboxCommand(sboxCommand, action, options);
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/CreateTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/CreateTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/CreateTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Creates a new target, if it does not exist.
+ * This command wraps the callback to service sb-conf setup [<TARGET>]
+ * [--compiler=<COMPILER>]
+ * [--devkits=<LIST>]
+ * [--cputransp=<METHOD>]
+ * [--force]
+ *
+ */
+public class CreateTargetCommand extends AbstractSDK1Command {
+
+
+ private ISDK sdk;
+
+ public CreateTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String compilerName = param.get(1);
+ String devkitsNames = param.get(2);
+ String cputranspName = param.get(3);
+
+ String setupTargetAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SETUP_ACT);
+
+ String[] setupActionOptionsReplaced = this.replaceActions(targetName,
+ compilerName, devkitsNames, cputranspName);
+ String setupTargetCommand = this.replaceScratchboxConfigCommand(
+ setupTargetAction, setupActionOptionsReplaced);
+
+ Process process = createProcess(setupTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ /**
+ * Replace the options of action SETUP. The options of SETUP action are
+ * different from the other ones, so this method replaces the variables
+ * properly.
+ *
+ * @param targetName
+ * the name of the target.
+ *
+ * @param compiler
+ * the compiler name of the target.
+ * @param devkits
+ * the devkits of the target.
+ * @param cputransp
+ * the cputransp method of the target.
+ * @return an array of String with the options already modified with the
+ * options.
+ */
+ protected String[] replaceActions(String targetName, String compiler,
+ String devkits, String cputransp) {
+ String[] setupActions = new String[4];
+ setupActions[0] = targetName;
+ setupActions[1] = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SETUP_OPT_COMPILER);
+ setupActions[2] = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SETUP_OPT_DEVKITS);
+ setupActions[3] = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SETUP_OPT_CPUTRANSP);
+
+ setupActions[1] = setupActions[1].replaceAll("\\$\\{COMPILER\\}",
+ compiler);
+ setupActions[2] = setupActions[2].replaceAll("\\$\\{LIST\\}", devkits);
+ setupActions[3] = setupActions[3].replaceAll("\\$\\{METHOD\\}",
+ cputransp);
+
+ return setupActions;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 4;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetCurrentTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetCurrentTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetCurrentTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Get the current Scratchbox 1 target.
+ * This command wraps the callback to service sb-conf current
+ */
+public class GetCurrentTargetCommand extends AbstractSDK1Command {
+
+ private final IScratchboxSDK sdk;
+
+ public GetCurrentTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public String performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ if (sdk.getCachedCurrentTarget() != null)
+ return sdk.getCachedCurrentTarget();
+
+ String currentTargetAction = commandAbstractor.getPreferenceValue(SB1PreferenceConstants.SB1_CURRENT_ACT);
+ String currentTargetCommand = this
+ .replaceScratchboxConfigCommand(currentTargetAction);
+
+ Process process = createProcess(currentTargetCommand, null);
+
+ String currentTarget = getInputFromProcessAndWait(process, true, 0);
+
+ sdk.setCachedCurrentTarget(currentTarget);
+ return currentTarget;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetGdbQemuCommandPatternCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetGdbQemuCommandPatternCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetGdbQemuCommandPatternCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,34 +10,34 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.sdk1.command;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.eclipse.core.runtime.IStatus;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.AbstractGetGdbQemuCommandPatternCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.sdk1.Activator;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1Target;
import org.osgi.framework.Version;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
/**
* Get the command pattern for launching qemu with the debugger
* @author eswartz
*
*/
-public class GetGdbQemuCommandPatternCommand extends AbstractGetGdbQemuCommandPatternCommand<ScratchboxSDK1Target> {
+public class GetGdbQemuCommandPatternCommand extends AbstractSDK1Command {
-
- public GetGdbQemuCommandPatternCommand(ScratchboxSDK1Target sdkTarget, ICommandAbstractor commandAbstractor, int sboxVersion) {
- super(sdkTarget,commandAbstractor, sboxVersion);
+ private ScratchboxSDK1Target sdkTarget;
+
+ public GetGdbQemuCommandPatternCommand(ScratchboxSDK1Target sdkTarget, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdkTarget = sdkTarget;
}
/*
@@ -95,4 +95,37 @@
return commandPattern;
}
+ /**
+ * Find what qemu is configured for this target.
+ * @return qemu name, or <code>null</code> if not using qemu
+ */
+ protected String getConfiguredQemu() throws ESboxException {
+
+ // we use sb-select show <target> to find out if qemu is even used for this target.
+ String showAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SHOW_ACT);
+ String showInfoCommandString = this
+ .replaceScratchboxConfigCommand(showAction,
+ new String[] { sdkTarget.getName() });
+
+ Process process = createProcess(showInfoCommandString, null);
+
+ List<String> lines = getLineInputFromProcessAndWait(process, true, 0);
+
+ // see if this is the line describing CPU transparency
+ Pattern namePattern = Pattern.compile(".*/(qemu-\\S+).*");
+ for (String line : lines) {
+ Matcher matcher = namePattern.matcher(line);
+ if (matcher.matches()) {
+ return matcher.group(1);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetVersionScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetVersionScratchboxCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/GetVersionScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Get the version of Scratchbox installed.
+ * This command wraps the callback to service sb-conf version.
+ *
+ */
+public class GetVersionScratchboxCommand extends AbstractSDK1Command {
+
+ public GetVersionScratchboxCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public String performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String sboxVersionAction;
+ sboxVersionAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_VERSION_ACT);
+ String currentSboxVersionCommand = this
+ .replaceScratchboxConfigCommand(sboxVersionAction);
+
+ Process process = createProcess(currentSboxVersionCommand, null);
+
+ String currentVersion = getInputFromProcessAndWait(process, false, 0);
+
+ return currentVersion;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/KillallCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/KillallCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/KillallCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Kill all Scratchbox sessions.
+ * This command wraps the callback to service sb-conf killall [-signal=<SIGNAL>]
+ *
+ */
+public class KillallCommand extends AbstractSDK1Command {
+
+ public KillallCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String signalValue = "";
+ if (param.size() > 0)
+ signalValue = param.get(0);
+
+ String killallAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_KILLALL_ACT);
+ String signalOption = this.replaceSignal(signalValue);
+ String killallCommand = this.replaceScratchboxConfigCommand(
+ killallAction, new String[] { signalOption });
+
+ Process process = createProcess(killallCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ /**
+ * Replace the value of SIGNAL option of killall action.
+ *
+ * @param signalValue
+ * the value of the signal to be replaced.
+ * @return the signal option of killall action replaced with the given
+ * signal value.
+ */
+ private String replaceSignal(String signalValue) {
+ if (signalValue.equals(""))
+ return "";
+ String killallSignalOption = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_KILLALL_OPT_SIGNAL);
+
+ String signalReplaced = killallSignalOption.replaceAll(
+ "\\$\\{SIGNAL\\}", signalValue);
+
+ return signalReplaced;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ // TODO Auto-generated method stub
+ return getParametersSize() <= 1;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCompilersCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCompilersCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCompilersCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * List the installed compilers.
+ * This command wraps the callback to service sb-conf list --compilers
+ *
+ */
+public class ListCompilersCommand extends AbstractSDK1Command {
+
+ public ListCompilersCommand(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, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_ACT);
+ String compilersOptions = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_OPT_COMPILERS);
+ String listCompilersCommand = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { compilersOptions });
+
+ Process process = createProcess(listCompilersCommand, null);
+
+ List<String> compilersAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return compilersAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCputranspCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCputranspCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListCputranspCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * List the installed cpu-transparency.
+ * This command wraps the callback to service sb-conf list --cputransps
+ *
+ */
+public class ListCputranspCommand extends AbstractSDK1Command {
+
+ public ListCputranspCommand(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, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_ACT);
+ String cputranpOption = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_OPT_CPU);
+ String listCputranspsCommandString = this
+ .replaceScratchboxConfigCommand(listAction,
+ new String[] { cputranpOption });
+
+ Process process = createProcess(listCputranspsCommandString, null);
+
+ List<String> cputranspsAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return cputranspsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListDevkitsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListDevkitsCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListDevkitsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * List the installed devkits.
+ * This command wraps the callback to service sb-conf list --devkits
+ *
+ */
+public class ListDevkitsCommand extends AbstractSDK1Command {
+
+ public ListDevkitsCommand(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, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_ACT);
+ String devkitsOption = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_OPT_DEVKITS);
+ String listDevkitsCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { devkitsOption });
+
+ Process process = createProcess(listDevkitsCommandString, null);
+
+ List<String> devkitsAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return devkitsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListSessionsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListSessionsCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListSessionsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -15,21 +15,20 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
/**
* List the current Scratchbox sessions.
* This command wraps the callback to service sb-conf list --sessions
*
*/
-public class ListSessionsCommand extends ScratchboxCommand {
+public class ListSessionsCommand extends AbstractSDK1Command {
public ListSessionsCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
/*
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListTargetsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListTargetsCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ListTargetsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * 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 AbstractSDK1Command {
+
+ 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, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction;
+ String targetsOption;
+ listAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_ACT);
+ targetsOption = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_LIST_OPT_TARGETS);
+ 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;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RemoveTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RemoveTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RemoveTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Remove a Scratchbox target.
+ * This command wraps the callback to service sb-conf remove [<TARGET>]
+ *
+ */
+public class RemoveTargetCommand extends AbstractSDK1Command {
+
+ private ISDK sdk;
+
+ public RemoveTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ 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.");
+
+ String removeTargetAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_REMOVE_ACT);
+ String forceRemoveTargetOption = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_REMOVE_OPT_FORCE);
+ String removeTargetCommand = this.replaceScratchboxConfigCommand(
+ removeTargetAction, new String[] { targetToRemove,
+ forceRemoveTargetOption });
+
+ Process process = createProcess(removeTargetCommand, null);
+
+ getInputFromProcessAndWait(process, true, 0);
+
+ 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 ESboxException {
+ List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor)
+ .performCommand(new ArrayList<String>());
+ return targetsAvailable.contains(targetToRemove);
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ResetTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ResetTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ResetTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Reset a Scratchbox target.
+ * This command wraps the callback to service sb-conf reset [<TARGET>]
+ *
+ */
+public class ResetTargetCommand extends AbstractSDK1Command {
+
+ public ResetTargetCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String resetTargetAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_RESET_ACT);
+ String resetTargetCommand = this.replaceScratchboxConfigCommand(
+ resetTargetAction, new String[] {});
+
+ Process process = createProcess(resetTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RootstrapCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RootstrapCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/RootstrapCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * This command wraps the callback to service sb-conf rootstrap [<TARGET>] <FILE>|<URL>
+ */
+public class RootstrapCommand extends AbstractSDK1Command {
+
+ public RootstrapCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String fileOrURL = param.get(0);
+
+ String rootstrapAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_ROOTSTRAP_ACT);
+ String rootstrapCommand = this.replaceScratchboxConfigCommand(
+ rootstrapAction, new String[] { fileOrURL });
+
+ Process process = createProcess(rootstrapCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/SelectTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/SelectTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/SelectTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Select a Scratchbox target.
+ * This command wraps the callback to service sb-conf select [<TARGET>]
+ *
+ */
+public class SelectTargetCommand extends AbstractSDK1Command {
+
+ private final IScratchboxSDK sdk;
+
+ public SelectTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetToSelect = param.get(0);
+
+ String selectTargetAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SELECT_ACT);
+ String selectTargetCommand = this.replaceScratchboxConfigCommand(
+ selectTargetAction, new String[] { targetToSelect });
+
+ Process process = createProcess(selectTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ sdk.setCachedCurrentTarget(targetToSelect);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ShowTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ShowTargetCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/command/ShowTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.command;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTarget;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
+
+/**
+ * Show the settings of a Scratchbox target.
+ * This command wraps the callback to service sb-conf show [<TARGET>]
+ *
+ */
+public class ShowTargetCommand extends AbstractSDK1Command {
+
+ public ShowTargetCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.internal.command.ICommand#performCommand(java.util.List)
+ */
+ public ScratchboxTarget performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ SB1PreferenceConstants.SB1_SHOW_ACT);
+ String showTargetCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { params.get(0) });
+
+ Process process = createProcess(showTargetCommandString, null);
+
+ ScratchboxTarget target = null;
+ List<String> targetInfo = getLineInputFromProcessAndWait(process, false, 0);
+ target = createTarget(params.get(0), targetInfo);
+
+ return target;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.scratchbox.internal.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ private ScratchboxTarget createTarget(String targetName,
+ List<String> targetInfo) {
+ ScratchboxTarget target = new ScratchboxTarget();
+
+ target.setName(targetName);
+
+ String compilerField = targetInfo.get(0);
+ String compiler = compilerField.substring(
+ compilerField.indexOf(":") + 1).trim();
+ target.setCompiler(compiler);
+
+ String devkitsField = targetInfo.get(1);
+ devkitsField = devkitsField.substring(devkitsField.indexOf(":") + 1);
+ StringTokenizer tokens = new StringTokenizer(devkitsField);
+ List<String> devkits = new ArrayList<String>();
+ while (tokens.hasMoreTokens()) {
+ devkits.add(tokens.nextToken());
+ }
+ target.setDevkits(devkits);
+
+ String cputranspField = targetInfo.get(2);
+ String cpuTransp = cputranspField.substring(
+ cputranspField.indexOf(":") + 1).trim();
+ target.setCputransp(cpuTransp);
+
+ return target;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/IScratchboxSDK1.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/IScratchboxSDK1.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/IScratchboxSDK1.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -3,16 +3,11 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
-public interface IScratchboxSDK1 {
- public static final String NAME = "Scratchbox 1"; //$NON-NLS-1$
- /** String for URI of machine where we detected scratchbox 1 */
- static final String SB1_MACHINE = "sb1_machine";
- /** String for scratchbox 1 version or <code>null</code> */
- static final String SB1_VERSION = "sb1_version";
- /** String[] scratchbox 1 target name array */
- static final String SB1_TARGETS = "sb1_targets";
+public interface IScratchboxSDK1 extends IScratchboxSDK{
+
public List<String> getDevkits() throws ESboxException;
public List<String> getSessions() throws ESboxException;
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/SB1PreferenceConstants.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/SB1PreferenceConstants.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/SB1PreferenceConstants.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk1.core;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.maemosdk.sdk1.Activator;
+
+/**
+ * This class encapsulates the keys for preference constants defined by Scratchbox 1.
+ * @author eswartz
+ *
+ */
+public class SB1PreferenceConstants {
+ public static final int VERSION_MAJOR = 17;
+ public static final int VERSION_MINOR = 0;
+
+ /** Get the preference store that contains these preferences */
+ public static IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+
+ /* SB1 configuration options */
+
+ public static final String RUN_SCRIPT_LOC = "RUN_SCRIPT_LOC";
+
+ public static final String SB1_GDB_REMOTE_QEMU = "SB1_GDB_REMOTE_QEMU";
+ public static final String SB1_CURRENT_ACT = "SB1_CURRENT_ACT";
+ public static final String SB1_SBOX_COMMAND = "SB1_SBOX_COMMAND";
+ public static final String SB1_REMOVE_ACT = "SB1_REMOVE_ACT";
+ public static final String SB1_REMOVE_OPT_FORCE = "SB1_REMOVE_OPT_FORCE";
+ public static final String SB1_RESET_ACT = "SB1_RESET_ACT";
+ public static final String SB1_ROOTSTRAP_ACT = "SB1_ROOTSTRAP_ACT";
+ public static final String SB1_ROOTSTRAP_OPT_FORCE = "SB1_ROOTSTRAP_OPT_FORCE";
+ public static final String SB1_INSTALL_ACT = "SB1_INSTALL_ACT";
+ public static final String SB1_INSTALL_OPT_CLIB = "SB1_INSTALL_OPT_CLIB";
+ public static final String SB1_INSTALL_OPT_DEVKITS = "SB1_INSTALL_OPT_DEVKITS";
+ public static final String SB1_INSTALL_OPT_ETC = "SB1_INSTALL_OPT_ETC";
+ public static final String SB1_INSTALL_OPT_FAKE = "SB1_INSTALL_OPT_FAKE";
+ public static final String SB1_INSTALL_OPT_GDB = "SB1_INSTALL_OPT_GDB";
+ public static final String SB1_INSTALL_OPT_STRACE = "SB1_INSTALL_OPT_STRACE";
+ public static final String SB1_KILLALL_ACT = "SB1_KILLALL_ACT";
+ public static final String SB1_KILLALL_OPT_SIGNAL = "SB1_KILLALL_OPT_SIGNAL";
+ public static final String SB1_LIST_ACT = "SB1_LIST_ACT";
+ public static final String SB1_LIST_OPT_COMPILERS = "SB1_LIST_OPT_COMPILERS";
+ public static final String SB1_LIST_OPT_CPU = "SB1_LIST_OPT_CPU";
+ public static final String SB1_LIST_OPT_DEVKITS = "SB1_LIST_OPT_DEVKITS";
+ public static final String SB1_LIST_OPT_SESSIONS = "SB1_LIST_OPT_SESSIONS";
+ public static final String SB1_LIST_OPT_TARGETS = "SB1_LIST_OPT_TARGETS";
+ public static final String SB1_LOGIN_COMMAND = "SB1_LOGIN_COMMAND";
+ public static final String SB1_SBOX_SANDBOX = "SB1_SBOX_SANDBOX";
+ public static final String SB1_SELECT_ACT = "SB1_SELECT_ACT";
+ public static final String SB1_SETUP_ACT = "SB1_SETUP_ACT";
+ public static final String SB1_SETUP_OPT_COMPILER = "SB1_SETUP_OPT_COMPILER";
+ public static final String SB1_SETUP_OPT_CPUTRANSP = "SB1_SETUP_OPT_CPUTRANSP";
+ public static final String SB1_SETUP_OPT_DEVKITS = "SB1_SETUP_OPT_DEVKITS";
+ public static final String SB1_SETUP_OPT_FORCE = "SB1_SETUP_OPT_FORCE";
+ public static final String SB1_SHOW_ACT = "SB1_SHOW_ACT";
+ public static final String SB1_SHOW_OPT_COMP_ARCH = "SB1_SHOW_OPT_COMP_ARCH";
+ public static final String SB1_SHOW_OPT_COMP_CLIB = "SB1_SHOW_OPT_COMP_CLIB";
+ public static final String SB1_SHOW_OPT_COMP_SUBARCH = "SB1_SHOW_OPT_COMP_SUBARCH";
+ public static final String SB1_SHOW_OPT_COMPILERS = "SB1_SHOW_OPT_COMPILERS";
+ public static final String SB1_SHOW_OPT_CPU = "SB1_SHOW_OPT_CPU";
+ public static final String SB1_SHOW_OPT_DEVKITS = "SB1_SHOW_OPT_DEVKITS";
+ public static final String SB1_VERSION_ACT = "SB1_VERSION_ACT";
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,51 +12,54 @@
import org.maemo.esbox.core.sdk.ISDKPlatform;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.sdk.BaseSDKPlatform;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetCurrentTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetVersionScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.KillallCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCompilersCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCputranspCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListDevkitsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.RemoveTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.SelectTargetCommand;
import org.maemo.esbox.maemosdk.core.MaemoSDKEngine;
import org.maemo.esbox.maemosdk.core.MaemoSDKInfo;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.MachineUtils;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
import org.maemo.esbox.maemosdk.sdk1.Activator;
+import org.maemo.esbox.maemosdk.sdk1.command.CreateTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.GetCurrentTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.GetVersionScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.KillallCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListCompilersCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListCputranspCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListDevkitsCommand;
import org.maemo.esbox.maemosdk.sdk1.command.ListSessionsCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListTargetsCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.RemoveTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.SelectTargetCommand;
public class ScratchboxSDK1 extends AbstractScratchboxSDK implements
IScratchboxSDK1 {
private IPath sdkRoot;
- private static final int SB_VERSION=1;
+// private static final int SB1_VERSION_NUMBER=1;
// private final IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider;
+// /** String for URI of machine where we detected scratchbox 1 */
+ static final String SB1_MACHINE = "sb1_machine";
+// /** String for scratchbox 1 version or <code>null</code> */
+ static final String SB1_VERSION = "sb1_version";
+
public ScratchboxSDK1(
IMachine machine,
-// IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider,
String version,
IPreferenceProvider prefProvider) {
- super(machine, version, NAME);
+ super(machine, version,
+ "Scratchbox 1",
+ "sb1_machine",
+ "sb1_version",
+ "sb1_targets",
+ 1);
this.sdkRoot=null;
this.prefProvider=prefProvider;
-// this.platformArchitectureProvider = platformArchitectureProvider;
}
@Override
- public int getSboxVersion() {
- return SB_VERSION;
- }
-
- @Override
public void refresh() {
super.refresh();
try {
@@ -96,8 +99,7 @@
CreateTargetCommand createTargetCommand = new CreateTargetCommand(this, getCommandAbstractor());
- setCachedValue(SB1_TARGETS, null);
-
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
return (Boolean) createTargetCommand.performCommand(params);
}
@@ -116,32 +118,47 @@
public static String getCurrentSboxVersion(IMachine machine) throws ESboxException {
// find cached value
- ensureCurrentMachine(SB1_MACHINE, machine);
- String version = (String) getCachedValue(SB1_VERSION);
+ MachineUtils.ensureCurrentMachine(SB1_MACHINE, machine);
+ String version = (String) ScratchboxSDKUtils.getInstance().getCachedValue(SB1_VERSION);
if (version != null)
return version;
// do the hard work
- acquireMachine(machine);
- ICommandAbstractor commandAbstractor = getHostCommandAbstractor(machine);
+ MachineUtils.acquireMachine(machine);
+ ICommandAbstractor commandAbstractor = MachineUtils.getHostCommandAbstractor(machine);
commandAbstractor = getSb1WrappedAbstractor(commandAbstractor,machine);
- GetVersionScratchboxCommand getVersionCommand = new GetVersionScratchboxCommand(
- commandAbstractor, SB_VERSION);
+ GetVersionScratchboxCommand getVersionCommand = new GetVersionScratchboxCommand(commandAbstractor);
String currentVersion = getVersionCommand.performCommand(new ArrayList<String>());
// remember cached value
- setCachedValue(SB1_VERSION, currentVersion);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB1_VERSION, currentVersion);
return currentVersion;
}
@Override
public String getCurrentTarget() throws ESboxException {
- ICommand getCurrentTargetCommand = new GetCurrentTargetCommand(getCommandAbstractor(), this);
+ GetCurrentTargetCommand getCurrentTargetCommand = new GetCurrentTargetCommand(getCommandAbstractor(), this);
return (String) getCurrentTargetCommand.performCommand(new ArrayList<String>());
}
+ public List<String> getTargets() throws ESboxException {
+ MachineUtils.ensureCurrentMachine(SB_MACHINE, this.getMachine());
+
+ String[] targetsArray = (String[]) ScratchboxSDKUtils.getInstance().getCachedValue(SB_TARGETS);
+ if (targetsArray != null)
+ return Arrays.asList(targetsArray);
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
+ getCommandAbstractor());
+ List<String> targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, (String[]) targets.toArray(new String[targets.size()]));
+
+ return targets;
+ }
+
@Override
public IPath getSDKRoot() {
if (sdkRoot == null) {
@@ -161,35 +178,14 @@
}
@Override
- public List<String> getTargets() throws ESboxException {
- String machineKey, targetsKey;
- machineKey = SB1_MACHINE;
- targetsKey = SB1_TARGETS;
-
- ensureCurrentMachine(machineKey, this.getMachine());
-
- String[] targetsArray = (String[]) getCachedValue(targetsKey);
- if (targetsArray != null)
- return Arrays.asList(targetsArray);
-
- ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
- getCommandAbstractor(), SB_VERSION);
- List<String> targets = listTargetsCommand.performCommand(new ArrayList<String>());
-
- setCachedValue(targetsKey, (String[]) targets.toArray(new String[targets.size()]));
-
- return targets;
- }
-
- @Override
public boolean removeTarget(String targetName) throws ESboxException {
List<String> params = new ArrayList<String>();
params.add(targetName);
- ICommand removeTargetCommand;
+ RemoveTargetCommand removeTargetCommand;
removeTargetCommand = new RemoveTargetCommand(this, getCommandAbstractor());
- setCachedValue(SB1_TARGETS, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
return (Boolean) removeTargetCommand.performCommand(params);
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1Target.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1Target.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/core/ScratchboxSDK1Target.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -9,7 +9,6 @@
import org.maemo.esbox.core.process.IProcessLauncherFactory;
import org.maemo.esbox.core.sdk.ISDKPlatform;
import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDKTarget;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.sdk1.command.GetGdbQemuCommandPatternCommand;
import org.maemo.esbox.maemosdk.sdk1.launcher.Scratchbox1ProcessLauncherFactory;
@@ -48,10 +47,9 @@
}
public synchronized String getGdbQemuCommandPattern(String architecture) throws ESboxException {
- IScratchboxSDK sdk = (IScratchboxSDK)this.getSDK();
+// IScratchboxSDK sdk = (IScratchboxSDK)this.getSDK();
GetGdbQemuCommandPatternCommand command = new GetGdbQemuCommandPatternCommand(this,
- this.getCommandAbstractor(),
- sdk.getSboxVersion());
+ this.getCommandAbstractor());
List<String> arguments = new ArrayList<String>(1);
arguments.add(architecture);
return command.performCommand(arguments);
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1EnvironmentProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1EnvironmentProvider.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1EnvironmentProvider.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -22,7 +22,7 @@
import org.maemo.esbox.core.process.ProcessLauncherUtils.Results;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.IStandardEnvironmentProvider;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.sdk1.Activator;
/**
* The standard environment provider for scratchbox caches the environment once
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1ProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1ProcessLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/Scratchbox1ProcessLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -29,9 +29,9 @@
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.Activator;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
/**
* For SB 1, we need to use a "run.sh" wrapper script. The
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/ScratchboxTargetSwitcher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/ScratchboxTargetSwitcher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/launcher/ScratchboxTargetSwitcher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -21,9 +21,9 @@
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.ProcessLauncherCreator;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
import org.maemo.esbox.maemosdk.core.scratchbox.ESboxScriptLauncher;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk1.Activator;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1Target;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/provider/ScratchboxSDK1Provider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/provider/ScratchboxSDK1Provider.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/provider/ScratchboxSDK1Provider.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -25,8 +25,8 @@
import org.maemo.esbox.core.sdk.ISDKProvider;
import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
import org.maemo.esbox.maemosdk.sdk1.Activator;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
@@ -69,7 +69,7 @@
logger.log(IStatus.INFO, "Problem scanning Scratchbox 1 installation", e);
}
}
- AbstractScratchboxSDK.saveCachedData();
+ ScratchboxSDKUtils.getInstance().saveCachedData();
return sdks;
}
@@ -81,7 +81,7 @@
private IScratchboxSDK getMachineSDKs(IPreferenceProvider prefProvider,
IMachine machine)
throws ESboxException {
- ErrorLogger logger = Activator.getErrorLogger();
+ ErrorLogger logger = Activator.getErrorLogger();
// only support one Scratchbox 1.x installation
String version = ScratchboxSDK1.getCurrentSboxVersion(machine);
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -21,10 +21,10 @@
import org.maemo.esbox.core.Policy;
import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
import org.maemo.esbox.maemosdk.sdk1.Activator;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
import org.maemo.esbox.maemosdk.sdk1.ui.wizard.NewScratchbox1TargetWizard;
+import org.maemo.esbox.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
/**
* @author eswartz
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/preferences/Scratchbox1PreferencesPage.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/preferences/Scratchbox1PreferencesPage.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk1/src/org/maemo/esbox/maemosdk/sdk1/ui/preferences/Scratchbox1PreferencesPage.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -23,10 +23,10 @@
import org.maemo.esbox.core.machine.ILocalMachine;
import org.maemo.esbox.core.sdk.SDKFactory;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
/**
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/META-INF/MANIFEST.MF 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/META-INF/MANIFEST.MF 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,8 +10,8 @@
org.maemo.esbox.maemosdk.ui;bundle-version="1.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.maemo.esbox.maemosdk.sdk2.command,
- org.maemo.esbox.maemosdk.sdk2.core,
- org.maemo.esbox.maemosdk.sdk2.launcher,
- org.maemo.esbox.maemosdk.sdk2.provider,
- org.maemo.esbox.maemosdk.sdk2.ui.preferences
+Export-Package: org.maemo.esbox.maemosdk.sdk2.command;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk2.core;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk2.launcher;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk2.provider;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.sdk2.ui.preferences;x-friends:="org.maemo.esbox.maemosdk.tests"
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/build.properties
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/build.properties 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/build.properties 2008-10-10 08:01:46 UTC (rev 861)
@@ -2,4 +2,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ conf/
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/plugin.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/plugin.xml 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/plugin.xml 2008-10-10 08:01:46 UTC (rev 861)
@@ -26,5 +26,15 @@
</adapter>
</factory>
</extension>
+ <extension
+ point="org.maemo.esbox.core.preference_set_provider">
+ <preferenceSetProvider
+ defaultsXMLFile="conf/sb2_prefs.xml"
+ preferenceConstantsClass="org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants"
+ preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
+ preferenceStoreBundle="org.maemo.esbox.maemosdk.sdk2"
+ version="17">
+ </preferenceSetProvider>
+ </extension>
</plugin>
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/Activator.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/Activator.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/Activator.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,8 +1,19 @@
package org.maemo.esbox.maemosdk.sdk2;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.maemo.esbox.core.ErrorLogger;
import org.osgi.framework.BundleContext;
@@ -17,6 +28,8 @@
// The shared instance
private static Activator plugin;
+ private IPreferenceStore preferenceStore;
+
/**
* The constructor
*/
@@ -82,4 +95,54 @@
public static ImageDescriptor getImageDescriptor(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns the preference store for this UI plug-in.
+ * This preference store is used to hold persistent settings for this plug-in in
+ * the context of a workbench. Some of these settings will be user controlled,
+ * whereas others may be internal setting that are never exposed to the user.
+ * <p>
+ * If an error occurs reading the preference store, an empty preference store is
+ * quietly created, initialized with defaults, and returned.
+ * </p>
+ * <p>
+ * <strong>NOTE:</strong> As of Eclipse 3.1 this method is
+ * no longer referring to the core runtime compatibility layer and so
+ * plug-ins relying on Plugin#initializeDefaultPreferences
+ * will have to access the compatibility layer themselves.
+ * </p>
+ *
+ * @return the preference store
+ */
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if (preferenceStore == null) {
+ preferenceStore = new ScopedPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
+
+ }
+ return preferenceStore;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/AbstractSDK2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/AbstractSDK2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/AbstractSDK2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,25 @@
+package org.maemo.esbox.maemosdk.sdk2.command;
+
+import java.security.InvalidParameterException;
+
+import org.maemo.esbox.maemosdk.core.command.AbstractSDKCommand;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+public abstract class AbstractSDK2Command extends AbstractSDKCommand {
+
+ public AbstractSDK2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ // TODO Auto-generated constructor stub
+ }
+
+ public String replaceScratchboxConfigCommand(String action, String[] options)throws InvalidParameterException {
+ String sboxCommand;
+
+ sboxCommand = commandAbstractor.getPreferenceValue(
+ SB2PreferenceConstants.SB2_CONFIG_COMMAND);
+
+ return replaceScratchboxCommand(sboxCommand, action, options);
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateMaemoRootstrapSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateMaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * Creates a new rootstrap for a target, if it does not exist.
+ * This command wraps the callback to service:
+ * <p>
+ * maemo-rootstrap [--force] install <target>
+ *
+ */
+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;
+ }
+
+ @Override
+ 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, ESboxException {
+ 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,
+ CorePlugin.getDefault().getConsole(true, null, "Installing rootstrap " + targetName));
+ doPerformCommand(params, envBlock, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateTargetSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/CreateTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.sdk2.Activator;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * 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 AbstractSDK2Command {
+
+
+ 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 ESboxException {
+ 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;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetCurrentTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetCurrentTargetSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetCurrentTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+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.core.CorePreferenceConstants;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Get the current Scratchgox 2 target.
+ * There is no command to do this, so read $HOME/.scratchbox2/config
+ */
+public class GetCurrentTargetSb2Command extends AbstractSDK2Command {
+
+ 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, ESboxException {
+ 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;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetGdbQemuCommandPatternCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetGdbQemuCommandPatternCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetGdbQemuCommandPatternCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,33 +10,28 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.sdk2.command;
-import org.eclipse.core.runtime.IStatus;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.AbstractGetGdbQemuCommandPatternCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.*;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2Target;
-import org.osgi.framework.Version;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
/**
* Get the command pattern for launching qemu with the debugger
* @author eswartz
*
*/
-public class GetGdbQemuCommandPatternCommand extends AbstractGetGdbQemuCommandPatternCommand<ScratchboxSDK2Target> {
-
- public GetGdbQemuCommandPatternCommand(ScratchboxSDK2Target sdkTarget, ICommandAbstractor commandAbstractor, int sboxVersion) {
- super(sdkTarget,commandAbstractor, sboxVersion);
+public class GetGdbQemuCommandPatternCommand extends AbstractSDK2Command {
+ private ScratchboxSDK2Target sdkTarget;
+
+ public GetGdbQemuCommandPatternCommand(ScratchboxSDK2Target sdkTarget, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdkTarget = sdkTarget;
}
/*
@@ -67,4 +62,39 @@
return commandPattern;
}
+ /**
+ * Find what qemu is configured for this target.
+ * @return qemu name, or <code>null</code> if not using qemu
+ */
+ protected String getConfiguredQemu() throws ESboxException {
+
+// // we use sb-select show <target> to find out if qemu is even used for this target.
+// String showAction = commandAbstractor.getPreferenceValue(
+// SB1PreferenceConstants.SB1_SHOW_ACT);
+// String showInfoCommandString = this
+// .replaceScratchboxConfigCommand(showAction,
+// new String[] { sdkTarget.getName() });
+//
+// Process process = createProcess(showInfoCommandString, null);
+//
+// List<String> lines = getLineInputFromProcessAndWait(process, true, 0);
+//
+// // see if this is the line describing CPU transparency
+// Pattern namePattern = Pattern.compile(".*/(qemu-\\S+).*");
+// for (String line : lines) {
+// Matcher matcher = namePattern.matcher(line);
+// if (matcher.matches()) {
+// return matcher.group(1);
+// }
+// }
+
+ return null;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetMaemoRootstrapLocationCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetMaemoRootstrapLocationCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetMaemoRootstrapLocationCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -18,10 +18,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2Target;
/**
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetVersionScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetVersionScratchboxCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/GetVersionScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * Get the version of Scratchbox installed.
+ * This command wraps the callback to service sb-conf version.
+ *
+ */
+public class GetVersionScratchboxCommand extends AbstractSDK2Command {
+
+ public GetVersionScratchboxCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public String performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String sboxVersionAction = commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_VERSION_ACT);
+
+ String currentSboxVersionCommand = this.replaceScratchboxConfigCommand(sboxVersionAction);
+
+ Process process = createProcess(currentSboxVersionCommand, null);
+
+ String currentVersion = getInputFromProcessAndWait(process, false, 0);
+
+ return currentVersion;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListAvailableMaemoRootstrapsSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * 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, ESboxException {
+ 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;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCompilersSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCompilersSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCompilersSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.Activator;
+
+/**
+ * List the installed compilers.
+ * There's no known command for this, but we can look in specific places.
+ *
+ */
+public class ListCompilersSb2Command extends AbstractSDK2Command {
+
+ 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, ESboxException {
+ 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;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCputranspSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCputranspSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListCputranspSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the installed compilers.
+ * There's no known command for this, but we can look in specific places.
+ *
+ */
+public class ListCputranspSb2Command extends AbstractSDK2Command {
+
+ public ListCputranspSb2Command(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, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> cputranspAvailable = new ArrayList<String>();
+
+ Set<String> expected = new HashSet<String>();
+ expected.add("sb2-qemu-arm");
+ expected.add("sbrsh");
+
+ Properties env = ProcessLauncherUtils.getSynthesizedEnvironment(commandAbstractor.getProcessLauncherFactory());
+ String pathenv = env.getProperty("PATH");
+ if (pathenv == null) {
+ pathenv = "/usr/bin:/bin"; // XXX
+ }
+ if (pathenv != null) {
+ String[] paths = pathenv.split(":");
+ for (String exp : expected) {
+ for (String path : paths) {
+ IFileStore bin = commandAbstractor.getFileSystemAccess().getFileStore(new Path(path).append(exp));
+ if (bin.fetchInfo().exists()) {
+ cputranspAvailable.add(bin.toURI().getPath());
+ break;
+ }
+ }
+ }
+ }
+
+ return cputranspAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListInstalledMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListInstalledMaemoRootstrapsSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * 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, ESboxException {
+ 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;
+ }
+
+}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListTargetsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListTargetsCommand.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ListTargetsCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * 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 AbstractSDK2Command {
+
+ 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, ESboxException {
+ 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/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/MaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/MaemoRootstrapSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/MaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -17,18 +17,17 @@
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
import org.maemo.esbox.core.process.CommandLineArguments;
import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
/**
* Base class for maemo rootstrap command.
*/
-public abstract class MaemoRootstrapSb2Command extends ScratchboxCommand {
+public abstract class MaemoRootstrapSb2Command extends AbstractSDK2Command {
public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
+ super(commandAbstractor);
}
@Override
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveMaemoRootstrapSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveMaemoRootstrapSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * 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, ESboxException {
+ 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,
+ CorePlugin.getDefault().getConsole(true, null, "Removing rootstrap " + targetName));
+
+ doPerformCommand(commands, envBlock, 0);
+
+ return Boolean.TRUE;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveTargetSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/RemoveTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -18,10 +18,8 @@
import org.eclipse.core.runtime.CoreException;
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2;
@@ -30,12 +28,12 @@
* There's no known command for this, but we can manually fix up the system.
*
*/
-public class RemoveTargetSb2Command extends ScratchboxCommand {
+public class RemoveTargetSb2Command extends AbstractSDK2Command {
private ScratchboxSDK2 sdk;
public RemoveTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 2);
+ super(commandAbstractor);
this.sdk = (ScratchboxSDK2) sdk;
}
@@ -85,7 +83,7 @@
*/
private boolean targetExist(String targetToRemove)
throws ESboxException {
- List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor, sboxVersion)
+ List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor)
.performCommand(new ArrayList<String>());
return targetsAvailable.contains(targetToRemove);
}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ShowPathMappingSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ShowPathMappingSb2Command.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/command/ShowPathMappingSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.command;
+
+import java.io.ByteArrayOutputStream;
+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.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
+
+/**
+ * Invoke 'sb2-show path' on a list of paths and return the mappings, or <code>null</code>
+ * for unmapped entries
+ * @author eswartz
+ *
+ */
+public class ShowPathMappingSb2Command extends AbstractSDK2Command {
+ public ShowPathMappingSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return true;
+ }
+
+ public Map<IPath, IPath> performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs(
+ commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_COMMAND),
+ commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_ACTION));
+ cmdLine.addAll(params);
+
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null, cmdLine);
+
+ /*Process process =*/ launcher.createProcess();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+
+ if (err.size() != 0)
+ throw new ScratchboxException("Cannot resolve scratchbox2 path mappings:\n"+ err);
+
+ String resolveInfo = out.toString().trim();
+ String[] lines = resolveInfo.split("\r\n|\r|\n");
+
+ Map<IPath, IPath> result = new HashMap<IPath, IPath>(lines.length);
+
+ Pattern sb2ShowPattern = Pattern.compile(
+ commandAbstractor.getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_OUTPUT_PATTERN));
+
+ for (String line : lines) {
+ Matcher matcher = sb2ShowPattern.matcher(line);
+ if (matcher.matches()) {
+ String toPath = matcher.group(2);
+ // workaround buggy output
+ if (toPath.startsWith("//"))
+ toPath = toPath.substring(1);
+ result.put(new Path(matcher.group(1)), new Path(toPath));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/IScratchboxSDK2.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/IScratchboxSDK2.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/IScratchboxSDK2.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -12,19 +12,14 @@
public interface IScratchboxSDK2 extends IScratchboxSDK{
- /** String for URI of machine where we detected scratchbox 2 */
- static final String SB2_MACHINE = "sb2_machine";
- /** String for scratchbox 2 version or <code>null</code> */
- static final String SB2_VERSION = "sb2_version";
- /** String[] scratchbox 2 target name array */
- static final String SB2_TARGETS = "sb2_targets";
+
/** Map<String,Map<String, String>> of sb2 target names to a map of the target directory to host directory path mappings */
static final String SB2_TARGET_TO_PATH_MAPPINGS_MAP = "sb2_target_to_path_mappings_map";
/** Map<String,String> of sb2 target names to rootstrap paths */
static final String SB2_TARGET_TO_ROOTSTRAP_MAP = "sb2_target_to_rootstrap_map";
- public static final String NAME = "Scratchbox 2";
+
public IPath getScratchbox2ConfigDirectory();
public boolean createRootstrapTarget(String targetName, boolean useHostTools, boolean force, IProgressMonitor monitor) throws ESboxException;
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/SB2PreferenceConstants.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/SB2PreferenceConstants.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/SB2PreferenceConstants.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.maemosdk.sdk2.core;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.maemosdk.sdk2.Activator;
+
+/**
+ * This class encapsulates the keys for preference constants defined by Scratchbox 2.
+ * @author eswartz
+ *
+ */
+public class SB2PreferenceConstants {
+ public static final int VERSION_MAJOR = 17;
+ public static final int VERSION_MINOR = 0;
+
+ /** Get the preference store that contains these preferences */
+ public static IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+
+ /* SB2 configuration options */
+ public static final String SB2_GDB_REMOTE_QEMU = "SB2_GDB_REMOTE_QEMU";
+ public static final String SB2_CONFIG_COMMAND = "SB2_CONFIG_COMMAND";
+ public static final String SB2_EXEC_COMMAND = "SB2_EXEC_COMMAND";
+ public static final String SB2_INIT_COMMAND = "SB2_INIT_COMMAND";
+ public static final String SB2_VERSION_ACT = "SB2_VERSION_ACT";
+ public static final String SB2_LIST_ACT = "SB2_LIST_ACT";
+ public static final String SB2_MAPPING_MODE = "SB2_MAPPING_MODE";
+ public static final String SB2_INSTALL_MAPPING_MODE = "SB2_INSTALL_MAPPING_MODE";
+ public static final String SB2_LOG_LEVEL = "SB2_LOG_LEVEL";
+ public static final String SB2_INIT_OPT_COMPILER = "SB2_INIT_OPT_COMPILER";
+ public static final String SB2_MAEMO_ROOTSTRAP_COMMAND = "SB2_MAEMO_ROOTSTRAP_COMMAND";
+ public static final String SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT = "SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_LIST_ACT = "SB2_MAEMO_ROOTSTRAP_LIST_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_INSTALL_ACT = "SB2_MAEMO_ROOTSTRAP_INSTALL_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_FORCE_OPT = "SB2_MAEMO_ROOTSTRAP_FORCE_OPT";
+ public static final String SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT = "SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT";
+ public static final String SB2_MAEMO_ROOTSTRAP_REMOVE_ACT = "SB2_MAEMO_ROOTSTRAP_REMOVE_ACT";
+ public static final String SB2_SB2_SHOW_COMMAND = "SB2_SB2_SHOW_COMMAND";
+ public static final String SB2_SB2_SHOW_PATH_ACTION = "SB2_SB2_SHOW_PATH_ACTION";
+ public static final String SB2_SB2_SHOW_PATH_OUTPUT_PATTERN = "SB2_SB2_SHOW_PATH_OUTPUT_PATTERN";
+ public static final String SB2_MAEMO_ROOTSTRAP_PATH_ACT = "SB2_MAEMO_ROOTSTRAP_PATH_ACT";
+
+}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -18,46 +18,54 @@
import org.maemo.esbox.core.sdk.ISDKPlatform;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.sdk.BaseSDKPlatform;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateMaemoRootstrapSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateTargetSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetCurrentTargetSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetVersionScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListAvailableMaemoRootstrapsSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCompilersSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCputranspSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListInstalledMaemoRootstrapsSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.RemoveMaemoRootstrapSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ShowPathMappingSb2Command;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.MachineUtils;
+import org.maemo.esbox.maemosdk.core.sdk.MaemoUtils;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
import org.maemo.esbox.maemosdk.sdk2.Activator;
+import org.maemo.esbox.maemosdk.sdk2.command.CreateMaemoRootstrapSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.CreateTargetSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.GetCurrentTargetSb2Command;
import org.maemo.esbox.maemosdk.sdk2.command.GetMaemoRootstrapLocationCommand;
+import org.maemo.esbox.maemosdk.sdk2.command.GetVersionScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk2.command.ListAvailableMaemoRootstrapsSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListCompilersSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListCputranspSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListInstalledMaemoRootstrapsSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListTargetsCommand;
+import org.maemo.esbox.maemosdk.sdk2.command.RemoveMaemoRootstrapSb2Command;
import org.maemo.esbox.maemosdk.sdk2.command.RemoveTargetSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ShowPathMappingSb2Command;
public class ScratchboxSDK2 extends AbstractScratchboxSDK implements
IScratchboxSDK2 {
- private static final int SB_VERSION = 2;
+// private static final int SB2_VERSION_NUMBER = 2;
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]+)");
+ private static final String SB2_MACHINE ="sb2_machine";
+ private static final String SB2_VERSION ="sb2_version";
+
+
public ScratchboxSDK2(
IMachine machine,
String version,
IPreferenceProvider prefProvider) {
- super(machine, version, NAME);
+ super(machine, version,
+ "Scratchbox 2",
+ SB2_MACHINE,
+ SB2_VERSION,
+ "sb2_targets",
+ 2);
this.prefProvider = prefProvider;
}
- @Override
- public int getSboxVersion() {
- return SB_VERSION;
- }
+
@Override
public void refresh() {
@@ -94,7 +102,21 @@
this.targets = newTargets;
}
-
+ public List<String> getTargets() throws ESboxException {
+ MachineUtils.ensureCurrentMachine(SB_MACHINE, this.getMachine());
+
+ String[] targetsArray = (String[]) ScratchboxSDKUtils.getInstance().getCachedValue(SB_TARGETS);
+ if (targetsArray != null)
+ return Arrays.asList(targetsArray);
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
+ getCommandAbstractor());
+ List<String> targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, (String[]) targets.toArray(new String[targets.size()]));
+
+ return targets;
+ }
@Override
public ICommandAbstractor getCommandAbstractor() throws ESboxException {
@@ -120,7 +142,7 @@
CreateTargetSb2Command createTargetCommand = new CreateTargetSb2Command(this, getCommandAbstractor());
- setCachedValue(SB2_TARGETS, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
return (Boolean) createTargetCommand.performCommand(params);
}
@@ -139,41 +161,22 @@
@Override
public String getCurrentTarget() throws ESboxException {
- ICommand getCurrentTargetCommand = new GetCurrentTargetSb2Command(getCommandAbstractor());
+ GetCurrentTargetSb2Command getCurrentTargetCommand = new GetCurrentTargetSb2Command(getCommandAbstractor());
return (String) getCurrentTargetCommand.performCommand(new ArrayList<String>());
}
- @Override
- public List<String> getTargets() throws ESboxException {
- String machineKey, targetsKey;
- machineKey = SB2_MACHINE;
- targetsKey = SB2_TARGETS;
-
- ensureCurrentMachine(machineKey, this.getMachine());
-
- String[] targetsArray = (String[]) getCachedValue(targetsKey);
- if (targetsArray != null)
- return Arrays.asList(targetsArray);
-
- ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
- getCommandAbstractor(), SB_VERSION);
- List<String> targets = listTargetsCommand.performCommand(new ArrayList<String>());
-
- setCachedValue(targetsKey, (String[]) targets.toArray(new String[targets.size()]));
-
- return targets;
- }
+
@Override
public boolean removeTarget(String targetName) throws ESboxException {
List<String> params = new ArrayList<String>();
params.add(targetName);
- ICommand removeTargetCommand;
+ RemoveTargetSb2Command removeTargetCommand;
removeTargetCommand = new RemoveTargetSb2Command(this, getCommandAbstractor());
- setCachedValue(SB2_TARGETS, null);
- setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
- setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
return (Boolean) removeTargetCommand.performCommand(params);
}
@@ -219,7 +222,8 @@
* @throws ESboxException
*/
public synchronized List<String> getInstalledMaemoRootstraps() throws ESboxException {
- ListInstalledMaemoRootstrapsSb2Command command = new ListInstalledMaemoRootstrapsSb2Command(getHostCommandAbstractor(this.getMachine()));
+ ListInstalledMaemoRootstrapsSb2Command command = new ListInstalledMaemoRootstrapsSb2Command(
+ MachineUtils.getHostCommandAbstractor(this.getMachine()));
return command.performCommand(EMPTY_ARGS);
}
@@ -227,7 +231,8 @@
@Override
public List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine) throws ESboxException{
- ListAvailableMaemoRootstrapsSb2Command command = new ListAvailableMaemoRootstrapsSb2Command(getHostCommandAbstractor(machine));
+ ListAvailableMaemoRootstrapsSb2Command command = new ListAvailableMaemoRootstrapsSb2Command(
+ MachineUtils.getHostCommandAbstractor(machine));
return command.performCommand(EMPTY_ARGS);
}
@@ -243,7 +248,7 @@
CreateMaemoRootstrapSb2Command createTargetCommand =
new CreateMaemoRootstrapSb2Command(this, getCommandAbstractor(), monitor);
- setCachedValue(SB2_TARGETS, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
return createTargetCommand.performCommand(params);
}
@@ -258,9 +263,9 @@
RemoveMaemoRootstrapSb2Command removeTargetCommand =
new RemoveMaemoRootstrapSb2Command(getCommandAbstractor(), monitor);
- setCachedValue(SB2_TARGETS, null);
- setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
- setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB_TARGETS, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
return removeTargetCommand.performCommand(params);
}
@@ -268,10 +273,11 @@
//public static
public static synchronized Map<IPath, IPath> getSb2PathMapping(IScratchboxSDKTarget sdkTarget, List<IPath> hostPaths) throws ESboxException {
// find cached value
- ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK().getMachine());
+ MachineUtils.ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK().getMachine());
Map<String, Map<String, String>> targetToPathMappingsMap = null;
Map<String, String> storedPathMappings = null;
- targetToPathMappingsMap = (Map<String, Map<String, String>>) getCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP);
+ targetToPathMappingsMap =
+ (Map<String, Map<String, String>>) ScratchboxSDKUtils.getInstance().getCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP);
if (targetToPathMappingsMap != null) {
storedPathMappings = targetToPathMappingsMap.get(sdkTarget.getName());
}
@@ -299,7 +305,7 @@
}
// do the hard work for the paths not covered by the cache
- ShowPathMappingSb2Command command = new ShowPathMappingSb2Command(getCommandAbstractor(sdkTarget));
+ ShowPathMappingSb2Command command = new ShowPathMappingSb2Command(MaemoUtils.getCommandAbstractor(sdkTarget));
List<String> paths = new ArrayList<String>(needToLookupHostPaths.size());
for (IPath path : needToLookupHostPaths) {
paths.add(path.toPortableString());
@@ -320,7 +326,7 @@
}
targetToPathMappingsMap.put(sdkTarget.getName(), storedPathMappings);
- setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, targetToPathMappingsMap);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, targetToPathMappingsMap);
return returnedPathMappings;
}
@@ -328,20 +334,20 @@
public static synchronized String getCurrentSbox2Version(IMachine machine)
throws ESboxException {
// find cached value
- ensureCurrentMachine(SB2_MACHINE, machine);
- String version = (String) getCachedValue(SB2_VERSION);
+ MachineUtils.ensureCurrentMachine(SB2_MACHINE, machine);
+ String version = (String) ScratchboxSDKUtils.getInstance().getCachedValue(SB2_VERSION);
if (version != null)
return version;
// do the hard work
- acquireMachine(machine);
- ICommandAbstractor commandAbstractor = getHostCommandAbstractor(machine);
- GetVersionScratchboxCommand getVersionCommand = new GetVersionScratchboxCommand(
- commandAbstractor, 2);
+ MachineUtils.acquireMachine(machine);
+ ICommandAbstractor commandAbstractor = MachineUtils.getHostCommandAbstractor(machine);
+ commandAbstractor = getSb2WrappedAbstractor(commandAbstractor, machine);
+ GetVersionScratchboxCommand getVersionCommand = new GetVersionScratchboxCommand(commandAbstractor);
String currentVersion = getVersionCommand.performCommand(new ArrayList<String>());
// remember cached value
- setCachedValue(SB2_VERSION, currentVersion);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_VERSION, currentVersion);
return currentVersion;
}
@@ -349,9 +355,9 @@
//private
private synchronized IPath getMaemoRootstrapPath(ScratchboxSDK2Target sdkTarget) throws ESboxException {
// find cached value
- ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK().getMachine());
+ MachineUtils.ensureCurrentMachine(SB_MACHINE, sdkTarget.getSDK().getMachine());
Map<String, String> targetToRootstrapMap = null;
- targetToRootstrapMap = (Map<String, String>) getCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP);
+ targetToRootstrapMap = (Map<String, String>) ScratchboxSDKUtils.getInstance().getCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP);
if (targetToRootstrapMap != null) {
String rootstrap = targetToRootstrapMap.get(sdkTarget.getName());
if (rootstrap != null) {
@@ -378,7 +384,7 @@
if (targetToRootstrapMap == null)
targetToRootstrapMap = new HashMap<String, String>();
targetToRootstrapMap.put(sdkTarget.getName(), rootstrapPath.toPortableString());
- setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, targetToRootstrapMap);
+ ScratchboxSDKUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, targetToRootstrapMap);
if (caughtException != null)
throw caughtException;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2Target.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2Target.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/core/ScratchboxSDK2Target.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -8,9 +8,7 @@
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.process.IProcessLauncherFactory;
import org.maemo.esbox.core.sdk.ISDKPlatform;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDKTarget;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
import org.maemo.esbox.maemosdk.sdk2.command.GetGdbQemuCommandPatternCommand;
import org.maemo.esbox.maemosdk.sdk2.launcher.Scratchbox2ProcessLauncherFactory;
@@ -71,10 +69,9 @@
* @return String or null if no cputransp used or not using qemu
*/
public synchronized String getGdbQemuCommandPattern(String architecture) throws ESboxException {
- ScratchboxSDK2 sdk = (ScratchboxSDK2)this.getSDK();
+// ScratchboxSDK2 sdk = (ScratchboxSDK2)this.getSDK();
GetGdbQemuCommandPatternCommand command = new GetGdbQemuCommandPatternCommand(this,
- this.getCommandAbstractor(),
- sdk.getSboxVersion());
+ this.getCommandAbstractor());
List<String> arguments = new ArrayList<String>(1);
arguments.add(architecture);
return command.performCommand(arguments);
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2EnvironmentProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2EnvironmentProvider.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2EnvironmentProvider.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -22,8 +22,8 @@
import org.maemo.esbox.core.process.ProcessLauncherUtils.Results;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.IStandardEnvironmentProvider;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.sdk2.Activator;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
/**
* @author eswartz
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,15 +10,18 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.sdk2.launcher;
+import java.util.List;
+
import org.eclipse.core.runtime.IPath;
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.process.BaseProcessLauncher;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
-import java.util.*;
-
/**
* For SB 2, launching is easy and follows the same pattern as a normal
* program invocation.
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncherFactory.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncherFactory.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/launcher/Scratchbox2ProcessLauncherFactory.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,17 +10,14 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.sdk2.launcher;
+import java.util.List;
+
import org.eclipse.core.runtime.IPath;
-import org.maemo.esbox.core.*;
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.*;
-import org.maemo.esbox.core.process.ProcessLauncherUtils.Results;
+import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
-import org.maemo.esbox.internal.maemosdk.core.Activator;
-import java.util.*;
-
/**
* @author eswartz
*
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/provider/ScratchboxSDK2Provider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/provider/ScratchboxSDK2Provider.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/provider/ScratchboxSDK2Provider.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -26,6 +26,7 @@
import org.maemo.esbox.core.sdk.ISDKProvider;
import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
import org.maemo.esbox.maemosdk.sdk2.Activator;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2;
@@ -74,7 +75,7 @@
}
}
- ScratchboxSDK2.saveCachedData();
+ ScratchboxSDKUtils.getInstance().saveCachedData();
return sdks;
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/ESboxTargetRemover.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/ESboxTargetRemover.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/ESboxTargetRemover.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -37,8 +37,7 @@
import org.eclipse.swt.widgets.Shell;
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.sdk2.Activator;
import org.maemo.esbox.maemosdk.sdk2.core.IScratchboxSDK2;
import org.maemo.esbox.project.core.ESboxBuildConfigurationParameters;
import org.maemo.esbox.project.core.IESboxBuildConfiguration;
@@ -87,7 +86,7 @@
new SubProgressMonitor(monitor, 1));
} catch (ESboxException e) {
// don't worry -- it may be a bogus target or one without a rootstrap
- UIActivator.getErrorLogger().logError("Problem removing rootstrap", e);
+ Activator.getErrorLogger().logError("Problem removing rootstrap", e);
}
if (monitor.isCanceled())
@@ -165,7 +164,7 @@
try {
projectHandle.save(new SubProgressMonitor(monitor, 1));
} catch (CoreException e) {
- UIActivator.getErrorLogger().logAndShowError("Failed to update project", e);
+ Activator.getErrorLogger().logAndShowError("Failed to update project", e);
}
}
@@ -195,7 +194,7 @@
lastConfig = config;
projectHandle.removeBuildConfiguration(config);
} catch (CoreException e) {
- UIActivator.getErrorLogger().logAndShowError("Could not remove build configuration", e);
+ Activator.getErrorLogger().logAndShowError("Could not remove build configuration", e);
}
}
}
@@ -205,7 +204,7 @@
try {
/*IESboxBuildConfiguration newConfig =*/ projectHandle.createBuildConfiguration(parameters, lastConfig);
} catch (CoreException e) {
- UIActivator.getErrorLogger().logAndShowError("Failed to add replacement build configuration", e);
+ Activator.getErrorLogger().logAndShowError("Failed to add replacement build configuration", e);
}
}
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -37,12 +37,11 @@
import org.maemo.esbox.core.Policy;
import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
-import org.maemo.esbox.internal.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
import org.maemo.esbox.maemosdk.sdk2.Activator;
import org.maemo.esbox.maemosdk.sdk2.core.IScratchboxSDK2;
import org.maemo.esbox.maemosdk.sdk2.ui.wizard.NewScratchbox2TargetWizard;
+import org.maemo.esbox.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
/**
* @author eswartz
@@ -94,7 +93,7 @@
}
}
} catch (ESboxException e1) {
- UIActivator.getErrorLogger().logError("Failure scanning maemo rootstraps", e1);
+ Activator.getErrorLogger().logError("Failure scanning maemo rootstraps", e1);
}
final boolean rootstrapUsed = rootstrapUsed_;
@@ -145,7 +144,7 @@
if (dialog.open() == 0) {
return removeTarget(shell, selectedTarget, deleteRootstrap[0]);
} else {
- return Policy.getCancelStatus(UIActivator.getDefault());
+ return Policy.getCancelStatus(Activator.getDefault());
}
}
@@ -168,7 +167,7 @@
} catch (Exception e) {
if (e.getCause() instanceof ESboxException)
e = (Exception) e.getCause();
- return UIActivator.createErrorStatus("Error removing target", e);
+ return Activator.createErrorStatus("Error removing target", e);
}
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/preferences/Scratchbox2PreferencesPage.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -11,13 +11,15 @@
package org.maemo.esbox.maemosdk.sdk2.ui.preferences;
-import org.eclipse.jface.preference.*;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
/**
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/MaemoRootstrapContentLabelProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/MaemoRootstrapContentLabelProvider.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/MaemoRootstrapContentLabelProvider.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -29,7 +29,6 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.machine.IMachine;
import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
import org.maemo.esbox.maemosdk.sdk2.core.IScratchboxSDK2;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/NewScratchbox2TargetWizard.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/NewScratchbox2TargetWizard.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/NewScratchbox2TargetWizard.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -39,7 +39,6 @@
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
import org.maemo.esbox.maemosdk.sdk2.Activator;
import org.maemo.esbox.maemosdk.sdk2.core.IScratchboxSDK2;
-import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2;
import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardCPUMethod;
import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardCompilerPage;
import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardNamePage;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/TargetWizardRootstrapSb2Page.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sdk2/src/org/maemo/esbox/maemosdk/sdk2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -32,7 +32,6 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeColumn;
import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.sdk2.core.IScratchboxSDK2;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2;
import org.maemo.esbox.maemosdk.ui.targets.wizards.IValidatePage;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -10,24 +10,34 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.tests;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
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.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.junit.Test;
-import org.maemo.esbox.core.*;
-import org.maemo.esbox.core.env.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.EnvironmentManager;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
import org.maemo.esbox.core.machine.IMachine;
import org.maemo.esbox.core.machine.MachineRegistry;
-import org.maemo.esbox.core.process.*;
-import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
import org.maemo.esbox.core.tests.core.BaseTest;
import org.maemo.esbox.internal.api.core.sdk.HostSDK;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.*;
-
/**
* Test the generic IProcessLauncher interface.
* This test is extended by SDK-specific tests which override
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -13,7 +13,6 @@
import java.io.ByteArrayOutputStream;
import java.util.Collections;
import java.util.List;
-import java.util.Properties;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,10 +14,10 @@
import org.junit.Before;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.MaemoUtils;
import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
import org.maemo.esbox.maemosdk.sdk2.core.ScratchboxSDK2;
@@ -48,7 +48,7 @@
for (ISDKTarget target : sb2Sdk.getSDKTargets()) {
if (target.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL) &&
!target.getName().contains("minimal")) {
- this.sb2ArmelTargetCommand = AbstractScratchboxSDK.getCommandAbstractor(target);//ScratchboxFacade.getInstance().getCommandAbstractor(target);
+ this.sb2ArmelTargetCommand = MaemoUtils.getCommandAbstractor(target);//ScratchboxFacade.getInstance().getCommandAbstractor(target);
break;
}
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -17,8 +17,8 @@
import org.maemo.esbox.core.process.HostProcessLauncherFactory;
import org.maemo.esbox.core.process.IProcessLauncherFactory;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.sdk2.core.SB2PreferenceConstants;
import org.maemo.esbox.maemosdk.sdk2.launcher.Scratchbox2ProcessLauncherFactory;
public class MockCommandAbstractor implements ICommandAbstractor {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,7 +14,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
-import java.util.Properties;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -16,12 +16,12 @@
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.RemoveTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.CreateTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListTargetsCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.RemoveTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
/**
* Please, read file TESTS.txt for more instructions about test.
@@ -64,13 +64,13 @@
param.add("qemu-arm-0.8.2-sb2");
createTargetCommand.performCommand(param);
- List<String> targetsAvailable = new ListTargetsCommand(sb1Command, 1)
+ 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, 1)
+ targetsAvailable = new ListTargetsCommand(sb1Command)
.performCommand(new ArrayList<String>());
assertTrue(!targetsAvailable.contains(TARGET_NAME));
@@ -85,7 +85,7 @@
} catch (ESboxException se) {
// expected
}
- targetsAvailable = new ListTargetsCommand(sb1Command, 1)
+ targetsAvailable = new ListTargetsCommand(sb1Command)
.performCommand(new ArrayList<String>());
assertTrue(!targetsAvailable.contains(TARGET_NAME));
}
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -4,8 +4,8 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateTargetSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk2.command.CreateTargetSb2Command;
public class TestCreateTargetSb2Command extends BaseTest {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -14,8 +14,8 @@
import java.util.ArrayList;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetCurrentTargetCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidOperationException;
+import org.maemo.esbox.maemosdk.sdk1.command.GetCurrentTargetCommand;
/**
* Please, read file TESTS.txt for more instructions about test.
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -20,12 +20,12 @@
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.ProcessLauncherCreator;
import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCompilersCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCputranspCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListDevkitsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+import org.maemo.esbox.maemosdk.sdk1.command.ListCompilersCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListCputranspCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListDevkitsCommand;
import org.maemo.esbox.maemosdk.sdk1.command.ListSessionsCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListTargetsCommand;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
/**
@@ -287,7 +287,7 @@
targetsExpected.add("CHINOOK_X86");
targetsExpected.add("DIABLO_ARMEL");
- ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb1Command, 1);
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb1Command);
List<String> targets = null;
try {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -17,17 +17,19 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.CorePreferenceConstants;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.HostUtils;
import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
import org.maemo.esbox.core.machine.IFileSystemAccess;
import org.maemo.esbox.core.process.IProcessLauncher;
import org.maemo.esbox.core.process.IProcessLauncherFactory;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListAvailableMaemoRootstrapsSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCompilersSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListCputranspSb2Command;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.sdk2.command.ListAvailableMaemoRootstrapsSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListCompilersSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListCputranspSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ListTargetsCommand;
/**
*/
@@ -125,7 +127,7 @@
targetsExpected.add("chinook40_armel");
targetsExpected.add("diablo41_armel");
- ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb2Command, 2);
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb2Command);
List<String> targets = null;
try {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -15,9 +15,9 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.RemoveTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidOperationException;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.RemoveTargetCommand;
/**
* Please, read file TESTS.txt for more instructions about test.
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -15,8 +15,8 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
import org.maemo.esbox.maemosdk.sdk2.command.RemoveTargetSb2Command;
/**
@@ -73,11 +73,11 @@
List<String> param = Collections.singletonList(TARGET);
try {
// ScratchboxFacade.getInstance().clearCachedData();
- AbstractScratchboxSDK.clearCachedData();
+ ScratchboxSDKUtils.getInstance().clearCachedData();
removeCommand.performCommand(param);
// ScratchboxFacade.getInstance().clearCachedData();
- AbstractScratchboxSDK.clearCachedData();
+ ScratchboxSDKUtils.getInstance().clearCachedData();
// targets = ScratchboxFacade.getInstance().getTargets(sb2Sdk);
targets = sb2Sdk.getTargets();
assertFalse(targets.contains(TARGET));
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -11,12 +11,15 @@
*******************************************************************************/
package org.maemo.esbox.maemosdk.tests.commands;
+import java.security.InvalidParameterException;
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.maemosdk.core.SB1PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.AbstractSDKCommand;
+import org.maemo.esbox.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.AbstractSDK1Command;
+import org.maemo.esbox.maemosdk.sdk1.core.SB1PreferenceConstants;
/**
* Please, read file TESTS.txt for more instructions about test.
@@ -28,11 +31,11 @@
*
* @author Raul Fernandes Herbster - raulherbster at gmail dot com
*/
- class MockScratchboxCommand extends ScratchboxCommand {
+ class MockScratchboxCommand extends AbstractSDK1Command {
public MockScratchboxCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor, 1);
+ super(commandAbstractor);
}
public Object performCommand(List<String> param)
@@ -46,6 +49,9 @@
return 0;
}
+
+
+
}
/**
@@ -56,7 +62,7 @@
final String stringToCompareA = "sb-conf current";
String currentTargetAction = sb1Sdk.getPreferenceValue(
SB1PreferenceConstants.SB1_CURRENT_ACT);
- ScratchboxCommand scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+ AbstractSDK1Command scratchboxCommandA = new MockScratchboxCommand(sb1Command);
String stringGetCurrent = scratchboxCommandA
.replaceScratchboxConfigCommand(currentTargetAction);
@@ -79,7 +85,7 @@
SB1PreferenceConstants.SB1_SHOW_OPT_DEVKITS);
String cpuTranspShowOption = sb1Sdk.getPreferenceValue(
SB1PreferenceConstants.SB1_SHOW_OPT_CPU);
- ScratchboxCommand scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+ AbstractSDK1Command scratchboxCommandA = new MockScratchboxCommand(sb1Command);
String stringShow = scratchboxCommandA.replaceScratchboxConfigCommand(
showAction, new String[] { compilersShowOption,
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -352,20 +352,15 @@
break;
}
}
- List<String> targetsAvailable = sdk.getTargets();
- if(targetsAvailable.contains(TARGET_NAME)){
- sdk.removeTarget(TARGET_NAME);
- targetsAvailable = sdk.getTargets();
- }
- assertFalse(targetsAvailable.contains(TARGET_NAME));
+
sdk.createTarget(
TARGET_NAME,
compiler,
"doctools:cputransp",
cputransp);
- targetsAvailable = sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
+ List<String> targetsAvailable = sdk.getTargets();//ScratchboxFacade.getInstance().getTargets(sdk);
assertTrue(targetsAvailable.contains(TARGET_NAME));
// remove the target created for the test
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -15,10 +15,10 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetCurrentTargetCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ListTargetsCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.SelectTargetCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.GetCurrentTargetCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.ListTargetsCommand;
+import org.maemo.esbox.maemosdk.sdk1.command.SelectTargetCommand;
/**
* Please, read file TESTS.txt for more instructions about test.
@@ -51,7 +51,7 @@
}
// find a known target which isn't the current one
- ListTargetsCommand listTargets = new ListTargetsCommand(sb1Command, 1);
+ ListTargetsCommand listTargets = new ListTargetsCommand(sb1Command);
param.clear();
List<String> targets = listTargets.performCommand(param);
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -7,7 +7,7 @@
import org.eclipse.core.runtime.IPath;
import org.maemo.esbox.core.ESboxException;
import org.maemo.esbox.core.machine.IFileSystemAccess;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ShowPathMappingSb2Command;
+import org.maemo.esbox.maemosdk.sdk2.command.ShowPathMappingSb2Command;
public class TestShowPathMappingSb2Command extends BaseTest {
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -15,9 +15,9 @@
import java.util.List;
import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
-import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ShowTargetCommand;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxCommand;
import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTarget;
+import org.maemo.esbox.maemosdk.sdk1.command.ShowTargetCommand;
import org.maemo.esbox.maemosdk.sdk1.core.ScratchboxSDK1;
/**
Modified: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF 2008-10-10 08:01:46 UTC (rev 861)
@@ -13,10 +13,8 @@
org.eclipse.ui.ide;bundle-version="3.4.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Export-Package: org.maemo.esbox.internal.maemosdk.ui,
- org.maemo.esbox.internal.maemosdk.ui.adapters,
- org.maemo.esbox.maemosdk.ui,
- org.maemo.esbox.maemosdk.ui.actions,
+Export-Package: org.maemo.esbox.maemosdk.ui.actions,
+ org.maemo.esbox.maemosdk.ui.adapters,
org.maemo.esbox.maemosdk.ui.preferences,
org.maemo.esbox.maemosdk.ui.targets.wizards,
org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,57 +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.maemosdk.ui.adapters;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.Policy;
-import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
-
-/**
- * @author eswartz
- *
- */
-public abstract class MaemoScratchboxSDKManageTargetAdapterBase implements ISDKManageTargetAdapter {
-
-
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#prepareRefresh()
- */
- public void prepareRefresh() {
- // this clears for both SB1 and SB2... oh well
- AbstractScratchboxSDK.clearCachedData();
- }
-}
Added: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java (rev 0)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.maemosdk.ui.adapters;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKUtils;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class MaemoScratchboxSDKManageTargetAdapterBase implements ISDKManageTargetAdapter {
+
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#prepareRefresh()
+ */
+ public void prepareRefresh() {
+ // this clears for both SB1 and SB2... oh well
+ ScratchboxSDKUtils.getInstance().clearCachedData();
+ }
+}
Deleted: branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-09 22:30:41 UTC (rev 860)
+++ branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-10 08:01:46 UTC (rev 861)
@@ -1,120 +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 implementation
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.ui.preferences;
-
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.maemo.esbox.maemosdk.core.SB2PreferenceConstants;
-
-
-/**
- * General preference page for scratchbox 2
- *
- * @author eswartz
- */
-public class Scratchbox2PreferencesPage extends FieldEditorPreferencePage implements
- IWorkbenchPreferencePage {
-
- /**
- * Field for build mapping mode
- */
- private StringFieldEditor feSbox2BuildMappingMode = null;
- /**
- * Field for install mapping mode
- */
- private StringFieldEditor feSbox2InstallMappingMode = null;
-
- /**
- * Field for log level
- */
- private RadioGroupFieldEditor feSbox2LogLevel = null;
-
- private StringFieldEditor feSbox2CommandLine;
-
- /**
- * The constructor
- */
- public Scratchbox2PreferencesPage() {
- super(GRID);
- setPreferenceStore(SB2PreferenceConstants.getPreferenceStore());
- setDescription("Options configuring scratchbox 2");
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- public void createFieldEditors() {
-
- feSbox2BuildMappingMode = new StringFieldEditor(
- SB2PreferenceConstants.SB2_MAPPING_MODE.toString(),
- "Build mapping mode:",
- getFieldEditorParent());
-
- feSbox2InstallMappingMode = new StringFieldEditor(
- SB2PreferenceConstants.SB2_INSTALL_MAPPING_MODE.toString(),
- "Install mapping mode:",
- getFieldEditorParent());
-
- feSbox2LogLevel = new RadioGroupFieldEditor(
- SB2PreferenceConstants.SB2_LOG_LEVEL.toString(),
- "Logging level:",
- 1,
- new String[][] {
- { "none",
- "" }, //$NON-NLS-1$
- { "error",
- "error" }, //$NON-NLS-1$
- { "warning",
- "warning" }, //$NON-NLS-1$
- { "notice",
- "notice" }, //$NON-NLS-1$
- { "info",
- "info" }, //$NON-NLS-1$
- { "debug",
- "debug" }, //$NON-NLS-1$
- { "noise",
- "noise" }, //$NON-NLS-1$
- },
- getFieldEditorParent());
-
- feSbox2CommandLine = new StringFieldEditor(
- SB2PreferenceConstants.SB2_EXEC_COMMAND.toString(),
- "Command template:",
- getFieldEditorParent());
-
- // make this string manageable
- GC gc = new GC(getFieldEditorParent().getShell());
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- gridData.widthHint = gc.getAdvanceWidth('m') * 32;
- gc.dispose();
- feSbox2CommandLine.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
-
- addField(feSbox2BuildMappingMode);
- addField(feSbox2InstallMappingMode);
- addField(feSbox2LogLevel);
- addField(feSbox2CommandLine);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- // Nothing to do
- }
-
-}
More information about the Esbox-commits
mailing list