Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-04-06 00:10:18 +0000
committerSimon Kaegi2008-04-06 00:10:18 +0000
commit0cd86cc43e14147a62d7fb02af970914a2b32484 (patch)
tree10b5884b6db7dd08866b553b8d22b5f03a11b86a
parentae10c771054169e8a3516f8219b1e06033aa4336 (diff)
downloadrt.equinox.p2-0cd86cc43e14147a62d7fb02af970914a2b32484.tar.gz
rt.equinox.p2-0cd86cc43e14147a62d7fb02af970914a2b32484.tar.xz
rt.equinox.p2-0cd86cc43e14147a62d7fb02af970914a2b32484.zip
Bug 225755 EclipseTouchpoint needs to be cleaned up
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java948
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java80
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java80
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java97
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MkdirAction.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java76
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RmdirAction.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkDependentPropertyAction.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkIndependentPropertyAction.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java101
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java78
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java63
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties20
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties10
28 files changed, 1424 insertions, 921 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
index 22e87a9a0..2837163f3 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
@@ -31,8 +31,9 @@ Import-Package: javax.xml.parsers,
org.w3c.dom,
org.xml.sax
Export-Package: org.eclipse.equinox.internal.p2.touchpoint.eclipse;x-friends:="org.eclipse.equinox.p2.reconciler.dropins",
+ org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;x-internal:=true,
org.eclipse.equinox.internal.p2.update;x-friends:="org.eclipse.equinox.p2.reconciler.dropins"
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
CDC-1.1/Foundation-1.1
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
index df7cfa005..63bd1575f 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
@@ -12,150 +12,57 @@ import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.*;
+import java.util.Map;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.engine.Profile;
-import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionFactory;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdminRuntimeException;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
+import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Version;
public class EclipseTouchpoint extends Touchpoint {
private static final TouchpointType TOUCHPOINT_TYPE = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.osgi", new Version("1.0")); //$NON-NLS-1$ //$NON-NLS-2$
- private static final String ARTIFACT_FOLDER = "artifact.folder"; //$NON-NLS-1$
- private static final String ACTION_ADD_JVM_ARG = "addJvmArg"; //$NON-NLS-1$
- private static final String ACTION_ADD_PROGRAM_ARG = "addProgramArg"; //$NON-NLS-1$
- private static final String ACTION_COLLECT = "collect"; //$NON-NLS-1$
- private static final String ACTION_INSTALL_BUNDLE = "installBundle"; //$NON-NLS-1$
- private static final String ACTION_INSTALL_FEATURE = "installFeature"; //$NON-NLS-1$
- private static final String ACTION_ADD_SOURCEBUNDLE = "addSourceBundle"; //$NON-NLS-1$
- private static final String ACTION_MARK_STARTED = "markStarted"; //$NON-NLS-1$
- private static final String ACTION_REMOVE_JVM_ARG = "removeJvmArg"; //$NON-NLS-1$
- private static final String ACTION_REMOVE_PROGRAM_ARG = "removeProgramArg"; //$NON-NLS-1$
- private static final String ACTION_SET_PROGRAM_PROP = "setProgramProperty"; //$NON-NLS-1$
- private static final String ACTION_SET_FW_DEPENDENT_PROP = "setFwDependentProp"; //$NON-NLS-1$
- private static final String ACTION_SET_FW_INDEPENDENT_PROP = "setFwIndependentProp"; //$NON-NLS-1$
- private static final String ACTION_UNINSTALL_BUNDLE = "uninstallBundle"; //$NON-NLS-1$
- private static final String ACTION_UNINSTALL_FEATURE = "uninstallFeature"; //$NON-NLS-1$
- private static final String ACTION_REMOVE_SOURCEBUNDLE = "removeSourceBundle"; //$NON-NLS-1$
- private static final String ACTION_SET_LAUNCHERNAME = "setLauncherName"; //$NON-NLS-1$
- private static final String ACTION_MKDIR = "mkdir"; //$NON-NLS-1$
- private static final String ACTION_RMDIR = "rmdir"; //$NON-NLS-1$
- private static final String PARM_ARTIFACT = "@artifact"; //$NON-NLS-1$
- private static final String PARM_ARTIFACT_REQUESTS = "artifactRequests"; //$NON-NLS-1$
- private static final String PARM_BUNDLE = "bundle"; //$NON-NLS-1$
- private static final String PARM_FEATURE = "feature"; //$NON-NLS-1$
- private static final String PARM_FEATURE_ID = "featureId"; //$NON-NLS-1$
- private static final String PARM_FEATURE_VERSION = "featureVersion"; //$NON-NLS-1$
- private static final String PARM_INSTALL_FOLDER = "installFolder"; //$NON-NLS-1$
- private static final String PARM_IU = "iu"; //$NON-NLS-1$
- private static final String PARM_JVM_ARG = "jvmArg"; //$NON-NLS-1$
- private static final String PARM_MANIPULATOR = "manipulator"; //$NON-NLS-1$
- private static final String PARM_PLATFORM_CONFIGURATION = "platformConfiguration"; //$NON-NLS-1$
- private static final String PARM_SOURCE_BUNDLES = "sourceBundles"; //$NON-NLS-1$
- private static final String PARM_OPERAND = "operand"; //$NON-NLS-1$
- private static final String PARM_PREVIOUS_START_LEVEL = "previousStartLevel"; //$NON-NLS-1$
- private static final String PARM_PREVIOUS_STARTED = "previousStarted"; //$NON-NLS-1$
- private static final String PARM_PREVIOUS_VALUE = "previousValue"; //$NON-NLS-1$
- private static final String PARM_PROFILE = "profile"; //$NON-NLS-1$
- private static final String PARM_PROGRAM_ARG = "programArg"; //$NON-NLS-1$
- private static final String PARM_PROP_NAME = "propName"; //$NON-NLS-1$
- private static final String PARM_PROP_VALUE = "propValue"; //$NON-NLS-1$
- private static final String PARM_SET_START_LEVEL = "setStartLevel"; //$NON-NLS-1$
- private static final String PARM_START_LEVEL = "startLevel"; //$NON-NLS-1$
- private static final String PARM_STARTED = "started"; //$NON-NLS-1$
- private static final String PARM_DEFAULT_VALUE = "default"; //$NON-NLS-1$
- private static final String PARM_LAUNCHERNAME = "name"; //$NON-NLS-1$
- private static final String PARM_PATH = "path"; //$NON-NLS-1$
-
// TODO: phase id constants should be defined elsewhere.
- private static final String INSTALL_PHASE_ID = "install"; //$NON-NLS-1$
- private static final String UNINSTALL_PHASE_ID = "uninstall"; //$NON-NLS-1$
-
- // private static final String CONFIGURE_PHASE_ID = "configure"; //$NON-NLS-1$
- // private static final String UNCONFIGURE_PHASE_ID = "unconfigure"; //$NON-NLS-1$
-
- static final String PROFILE_PROP_LAUNCHER_NAME = "eclipse.touchpoint.launcherName"; //$NON-NLS-1$
-
- protected static IStatus createError(String message) {
- return createError(message, null);
- }
-
- protected static IStatus createError(String message, Exception e) {
- return new Status(IStatus.ERROR, Activator.ID, message, e);
- }
-
- // TODO: Here we may want to consult multiple caches
- IArtifactRequest[] collect(IInstallableUnit installableUnit, IProfile profile) {
- IArtifactKey[] toDownload = installableUnit.getArtifacts();
- if (toDownload == null || toDownload.length == 0)
- return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
-
- IArtifactRepository aggregatedRepositoryView = Util.getAggregatedBundleRepository(profile);
- IArtifactRepository bundlePool = Util.getBundlePoolRepository(profile);
- List requests = new ArrayList();
- for (int i = 0; i < toDownload.length; i++) {
- IArtifactKey key = toDownload[i];
- if (!aggregatedRepositoryView.contains(key)) {
- Properties repositoryProperties = createArtifactDescriptorProperties(installableUnit);
- requests.add(Util.getArtifactRepositoryManager().createMirrorRequest(key, bundlePool, null, repositoryProperties));
- }
- }
-
- if (requests.isEmpty())
- return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
+ public static final String INSTALL_PHASE_ID = "install"; //$NON-NLS-1$
+ public static final String UNINSTALL_PHASE_ID = "uninstall"; //$NON-NLS-1$
- IArtifactRequest[] result = (IArtifactRequest[]) requests.toArray(new IArtifactRequest[requests.size()]);
- return result;
- }
-
- private Properties createArtifactDescriptorProperties(IInstallableUnit installableUnit) {
- Properties descriptorProperties = null;
- if (isZipped(installableUnit.getTouchpointData())) {
- descriptorProperties = new Properties();
- descriptorProperties.setProperty(ARTIFACT_FOLDER, Boolean.TRUE.toString());
- }
- return descriptorProperties;
- }
-
- boolean isZipped(TouchpointData[] data) {
- if (data == null || data.length == 0)
- return false;
- for (int i = 0; i < data.length; i++) {
- if (data[i].getInstructions("zipped") != null) //$NON-NLS-1$
- return true;
- }
- return false;
- }
+ public static final String PROFILE_PROP_LAUNCHER_NAME = "eclipse.touchpoint.launcherName"; //$NON-NLS-1$
+ public static final String PARM_MANIPULATOR = "manipulator"; //$NON-NLS-1$
+ public static final String PARM_PLATFORM_CONFIGURATION = "platformConfiguration"; //$NON-NLS-1$
+ public static final String PARM_SOURCE_BUNDLES = "sourceBundles"; //$NON-NLS-1$
+ public static final String PARM_IU = "iu"; //$NON-NLS-1$
+ public static final String PARM_INSTALL_FOLDER = "installFolder"; //$NON-NLS-1$
public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) {
- Manipulator manipulator = (Manipulator) touchpointParameters.get(PARM_MANIPULATOR);
+ Manipulator manipulator = (Manipulator) touchpointParameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
try {
manipulator.save(false);
} catch (RuntimeException e) {
- return createError("Error saving manipulator", e); //$NON-NLS-1$
+ return Util.createError(Messages.error_saving_manipulator, e);
} catch (IOException e) {
- return createError("Error saving manipulator", e); //$NON-NLS-1$
+ return Util.createError(Messages.error_saving_manipulator, e);
}
if (INSTALL_PHASE_ID.equals(phaseId) || UNINSTALL_PHASE_ID.equals(phaseId)) {
- PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) touchpointParameters.get(PARM_PLATFORM_CONFIGURATION);
+ PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) touchpointParameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION);
try {
configuration.save();
} catch (ProvisionException pe) {
- return createError("Error saving platform configuration.", pe); //$NON-NLS-1$
+ return Util.createError(Messages.error_saving_platform_configuration, pe);
}
}
- SourceManipulator m = (SourceManipulator) touchpointParameters.get(PARM_SOURCE_BUNDLES);
+ SourceManipulator m = (SourceManipulator) touchpointParameters.get(EclipseTouchpoint.PARM_SOURCE_BUNDLES);
try {
m.save();
} catch (IOException e) {
- return createError("Error saving source bundles list", e); //$NON-NLS-1$
+ return Util.createError(Messages.error_saving_source_bundles_list, e);
}
return Status.OK_STATUS;
@@ -166,572 +73,16 @@ public class EclipseTouchpoint extends Touchpoint {
URL configURL = null;
try {
configURL = configDir.toURI().toURL();
- } catch (IllegalArgumentException iae) {
- throw new CoreException(createError("Configuration directory is not absolute.", iae)); //$NON-NLS-1$
- } catch (MalformedURLException mue) {
- throw new CoreException(createError("No URL protocol handler.", mue)); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ throw new CoreException(Util.createError("Configuration directory is not absolute.", e)); //$NON-NLS-1$
+ } catch (MalformedURLException e) {
+ throw new CoreException(Util.createError("No URL protocol handler.", e)); //$NON-NLS-1$
}
return configURL;
}
public ProvisioningAction getAction(String actionId) {
- if (actionId.equals(ACTION_COLLECT)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
- IArtifactRequest[] requests = collect(operand.second(), profile);
-
- Collection artifactRequests = (Collection) parameters.get(PARM_ARTIFACT_REQUESTS);
- artifactRequests.add(requests);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- // nothing to do for now
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_INSTALL_BUNDLE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return installBundle(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return uninstallBundle(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_UNINSTALL_BUNDLE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return uninstallBundle(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return installBundle(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_ADD_SOURCEBUNDLE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return addSourceBundle(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return removeSourceBundle(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_REMOVE_SOURCEBUNDLE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return removeSourceBundle(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return addSourceBundle(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_INSTALL_FEATURE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return installFeature(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return uninstallFeature(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_UNINSTALL_FEATURE)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- return uninstallFeature(parameters);
- }
-
- public IStatus undo(Map parameters) {
- return installFeature(parameters);
- }
- };
- }
-
- if (actionId.equals(ACTION_SET_LAUNCHERNAME)) {
- return new ProvisioningAction() {
- private IStatus changeName(String newName, Manipulator manipulator, Profile profile) {
- try {
- //force the load to make sure we read the values in the old filename
- manipulator.load();
- } catch (IllegalStateException e) {
- return createError(Messages.error_loading_manipulator);
- } catch (FrameworkAdminRuntimeException e) {
- return createError(Messages.error_loading_manipulator);
- } catch (IOException e) {
- return createError(Messages.error_loading_manipulator);
- }
- getMemento().put(PROFILE_PROP_LAUNCHER_NAME, profile.getProperty(PROFILE_PROP_LAUNCHER_NAME));
- profile.setProperty(PROFILE_PROP_LAUNCHER_NAME, newName);
- manipulator.getLauncherData().setLauncher(Util.getLauncherPath(profile));
- return Status.OK_STATUS;
- }
-
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- Profile profile = (Profile) parameters.get(PARM_PROFILE);
- return changeName((String) parameters.get(PARM_LAUNCHERNAME), manipulator, profile);
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- Profile profile = (Profile) parameters.get(PARM_PROFILE);
- return changeName((String) getMemento().get(PROFILE_PROP_LAUNCHER_NAME), manipulator, profile);
- }
- };
- }
-
- if (actionId.equals(ACTION_ADD_PROGRAM_ARG)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String programArg = (String) parameters.get(PARM_PROGRAM_ARG);
- if (programArg == null)
- return createError("The \"programArg\" parameter was not set in the \"add program args\" action."); //$NON-NLS-1$
-
- if (programArg.equals(PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getBundleFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return createError("The file is not available" + fileLocation.getAbsolutePath()); //$NON-NLS-1$
- programArg = fileLocation.getAbsolutePath();
- }
-
- manipulator.getLauncherData().addProgramArg(programArg);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String programArg = (String) parameters.get(PARM_PROGRAM_ARG);
- if (programArg == null)
- return createError("The \"programArg\" parameter was not set in the \"add program args\" action."); //$NON-NLS-1$
-
- if (programArg.equals(PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getBundleFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return createError("The file is not available" + fileLocation.getAbsolutePath()); //$NON-NLS-1$
- programArg = fileLocation.getAbsolutePath();
- }
-
- manipulator.getLauncherData().removeProgramArg(programArg);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_REMOVE_PROGRAM_ARG)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String programArg = (String) parameters.get(PARM_PROGRAM_ARG);
- if (programArg == null)
- return createError("The \"programArg\" parameter was not set in the \"remove program args\" action."); //$NON-NLS-1$
-
- if (programArg.equals(PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getBundleFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return createError("The artifact for " + artifactKey + " is not available"); //$NON-NLS-1$ //$NON-NLS-2$
- programArg = fileLocation.getAbsolutePath();
- }
-
- manipulator.getLauncherData().removeProgramArg(programArg);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String programArg = (String) parameters.get(PARM_PROGRAM_ARG);
- if (programArg == null)
- return createError("The \"programArg\" parameter was not set in the \"remove program args\" action."); //$NON-NLS-1$
-
- if (programArg.equals(PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getBundleFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return createError("The artifact for " + artifactKey + " is not available"); //$NON-NLS-1$ //$NON-NLS-2$
- programArg = fileLocation.getAbsolutePath();
- }
-
- manipulator.getLauncherData().addProgramArg(programArg);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(PARM_SET_START_LEVEL)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- String startLevel = (String) parameters.get(PARM_START_LEVEL);
- if (startLevel == null)
- return createError("The \"startLevel\" parameter was not set in the \"set start level\" action."); //$NON-NLS-1$
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
-
- BundleInfo[] bundles = manipulator.getConfigData().getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].equals(bundleInfo)) {
- getMemento().put(PARM_PREVIOUS_START_LEVEL, new Integer(bundles[i].getStartLevel()));
- try {
- bundles[i].setStartLevel(Integer.parseInt(startLevel));
- } catch (NumberFormatException e) {
- return createError("Error parsing start level: " + startLevel + " for bundle: " + bundles[i].getSymbolicName(), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
- }
- }
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
-
- BundleInfo[] bundles = manipulator.getConfigData().getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].equals(bundleInfo)) {
- Integer previousStartLevel = (Integer) getMemento().get(PARM_PREVIOUS_START_LEVEL);
- if (previousStartLevel != null)
- bundles[i].setStartLevel(previousStartLevel.intValue());
- break;
- }
- }
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_MARK_STARTED)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- String started = (String) parameters.get(PARM_STARTED);
- if (started == null)
- return createError("The \"started\" parameter was not set in the \"mark started\" action."); //$NON-NLS-1$
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
-
- BundleInfo[] bundles = manipulator.getConfigData().getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].equals(bundleInfo)) {
- getMemento().put(PARM_PREVIOUS_STARTED, new Boolean(bundles[i].isMarkedAsStarted()));
- bundles[i].setMarkedAsStarted(Boolean.valueOf(started).booleanValue());
- break;
- }
- }
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = artifacts[0];
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
-
- BundleInfo[] bundles = manipulator.getConfigData().getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].equals(bundleInfo)) {
- Boolean previousStarted = (Boolean) getMemento().get(PARM_PREVIOUS_STARTED);
- if (previousStarted != null)
- bundles[i].setMarkedAsStarted(previousStarted.booleanValue());
- break;
- }
- }
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_SET_FW_DEPENDENT_PROP)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set framework dependent properties\" action."); //$NON-NLS-1$
- String propValue = (String) parameters.get(PARM_PROP_VALUE);
- if (propValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set framework dependent properties\" action."); //$NON-NLS-1$
- getMemento().put(PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
- manipulator.getConfigData().setFwDependentProp(propName, propValue);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set framework dependent properties\" action."); //$NON-NLS-1$
- String previousValue = (String) getMemento().get(PARM_PREVIOUS_VALUE);
- if (previousValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set framework dependent properties\" action."); //$NON-NLS-1$
- manipulator.getConfigData().setFwDependentProp(propName, previousValue);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_SET_FW_INDEPENDENT_PROP)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set framework independent properties\" action."); //$NON-NLS-1$
- String propValue = (String) parameters.get(PARM_PROP_VALUE);
- if (propValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set framework independent properties\" action."); //$NON-NLS-1$
- getMemento().put(PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
- manipulator.getConfigData().setFwIndependentProp(propName, propValue);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set framework independent properties\" action."); //$NON-NLS-1$
- String previousValue = (String) getMemento().get(PARM_PREVIOUS_VALUE);
- if (previousValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set framework independent properties\" action."); //$NON-NLS-1$
- manipulator.getConfigData().setFwIndependentProp(propName, previousValue);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_SET_PROGRAM_PROP)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set program property\" action."); //$NON-NLS-1$
- String propValue = (String) parameters.get(PARM_PROP_VALUE);
- if (propValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set program property\" action."); //$NON-NLS-1$
- getMemento().put(PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
- manipulator.getConfigData().setFwDependentProp(propName, propValue);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String propName = (String) parameters.get(PARM_PROP_NAME);
- if (propName == null)
- return createError("The \"propName\" parameter was not set in the \"set program property\" action."); //$NON-NLS-1$
- String previousValue = (String) getMemento().get(PARM_PREVIOUS_VALUE);
- if (previousValue == null)
- return createError("The \"propValue\" parameter was not set in the \"set program property\" action."); //$NON-NLS-1$
- manipulator.getConfigData().setFwDependentProp(propName, previousValue);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_ADD_JVM_ARG)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String jvmArg = (String) parameters.get(PARM_JVM_ARG);
- if (jvmArg == null)
- return createError("The \"jvmArg\" parameter was not set in the \"add jvm args\" action."); //$NON-NLS-1$
- manipulator.getLauncherData().addJvmArg(jvmArg);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String jvmArg = (String) parameters.get(PARM_JVM_ARG);
- if (jvmArg == null)
- return createError("The \"jvmArg\" parameter was not set in the \"add jvm args\" action."); //$NON-NLS-1$
- manipulator.getLauncherData().removeJvmArg(jvmArg);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_REMOVE_JVM_ARG)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String jvmArg = (String) parameters.get(PARM_JVM_ARG);
- if (jvmArg == null)
- return createError("The \"jvmArg\" parameter was not set in the \"remove jvm args\" action."); //$NON-NLS-1$
- manipulator.getLauncherData().removeJvmArg(jvmArg);
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String jvmArg = (String) parameters.get(PARM_JVM_ARG);
- if (jvmArg == null)
- return createError("The \"jvmArg\" parameter was not set in the \"remove jvm args\" action."); //$NON-NLS-1$
- manipulator.getLauncherData().addJvmArg(jvmArg);
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_MKDIR)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- String path = (String) parameters.get(PARM_PATH);
- if (path == null)
- return createError("The \"path\" parameter was not set in the \"mkdir\" action."); //$NON-NLS-1$
- new File(path).mkdir();
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- String path = (String) parameters.get(PARM_PATH);
- if (path == null)
- return createError("The \"path\" parameter was not set in the \"mkdir\" action."); //$NON-NLS-1$
- new File(path).delete();
- return Status.OK_STATUS;
- }
- };
- }
-
- if (actionId.equals(ACTION_RMDIR)) {
- return new ProvisioningAction() {
- public IStatus execute(Map parameters) {
- String path = (String) parameters.get(PARM_PATH);
- if (path == null)
- return createError("The \"path\" parameter was not set in the \"rmdir\" action."); //$NON-NLS-1$
- new File(path).delete();
- return Status.OK_STATUS;
- }
-
- public IStatus undo(Map parameters) {
- String path = (String) parameters.get(PARM_PATH);
- if (path == null)
- return createError("The \"path\" parameter was not set in the \"rmdir\" action."); //$NON-NLS-1$
- new File(path).mkdir();
- return Status.OK_STATUS;
- }
- };
- }
-
- return null;
+ return ActionFactory.create(actionId);
}
public TouchpointType getTouchpointType() {
@@ -750,179 +101,23 @@ public class EclipseTouchpoint extends Touchpoint {
touchpointParameters.put(PARM_PLATFORM_CONFIGURATION, new PlatformConfigurationWrapper(configURL, poolURL, manipulator));
} catch (CoreException ce) {
touchpointParameters.put(PARM_PLATFORM_CONFIGURATION, new PlatformConfigurationWrapper(null, null, null));
- return createError("Error constructing platform configuration url.", ce); //$NON-NLS-1$
+ return Util.createError(Messages.error_constructing_platform_configuration_url, ce);
}
return null;
}
public IStatus initializeOperand(IProfile profile, String phaseId, InstallableUnitOperand operand, Map parameters) {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- if (iu != null && Boolean.valueOf(iu.getProperty(IInstallableUnit.PROP_PARTIAL_IU)).booleanValue())
- parameters.put(PARM_IU, prepareIU(iu, profile));
+ if (iu != null && Boolean.valueOf(iu.getProperty(IInstallableUnit.PROP_PARTIAL_IU)).booleanValue()) {
+ IInstallableUnit preparedIU = prepareIU(iu, profile);
+ if (preparedIU == null)
+ return Util.createError(NLS.bind(Messages.failed_prepareIU, iu));
- return null;
- }
-
- IStatus installBundle(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String bundleId = (String) parameters.get(PARM_BUNDLE);
- if (bundleId == null)
- return createError("The \"bundleId\" parameter is missing from the \"install bundle\" action"); //$NON-NLS-1$
-
- //TODO: eventually remove this. What is a fragment doing here??
- if (iu.isFragment()) {
- System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
- break;
- }
+ parameters.put(PARM_IU, preparedIU);
}
- if (artifactKey == null)
- throw new IllegalArgumentException("No artifact found that matches: " + bundleId); //$NON-NLS-1$
-
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " to install was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- //By now we always have the manifest in the touchpoint data
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
- manipulator.getConfigData().addBundle(bundleInfo);
-
- return Status.OK_STATUS;
- }
-
- protected IStatus uninstallBundle(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- Manipulator manipulator = (Manipulator) parameters.get(PARM_MANIPULATOR);
- String bundleId = (String) parameters.get(PARM_BUNDLE);
- if (bundleId == null)
- return createError("The \"bundleId\" parameter is missing from the \"uninstall bundle\" action."); //$NON-NLS-1$
-
- //TODO: eventually remove this. What is a fragment doing here??
- if (iu.isFragment()) {
- System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
- break;
- }
- }
- if (artifactKey == null)
- throw new IllegalArgumentException("No artifact found that matches: " + bundleId); //$NON-NLS-1$
-
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- // TODO: do we really need the manifest here or just the bsn and version?
- String manifest = Util.getManifest(iu.getTouchpointData());
- if (manifest == null)
- return createError("The manifest is missing for: " + iu); //$NON-NLS-1$
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
- if (bundleInfo == null)
- return createError("Failed to create bundleInfo for: " + iu); //$NON-NLS-1$
- manipulator.getConfigData().removeBundle(bundleInfo);
-
return Status.OK_STATUS;
}
- IStatus installFeature(Map parameters) {
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(PARM_PLATFORM_CONFIGURATION);
- String feature = (String) parameters.get(PARM_FEATURE);
- String featureId = (String) parameters.get(PARM_FEATURE_ID);
- String featureVersion = (String) parameters.get(PARM_FEATURE_VERSION);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit for eclipse feature contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(feature)) {
- artifactKey = artifacts[i];
- break;
- }
- }
-
- if (featureId == null)
- return createError("The \"featureId\" parameter is missing from the \"install feature\" action"); //$NON-NLS-1$
- else if (PARM_DEFAULT_VALUE.equals(featureId)) {
- featureId = artifactKey.getId();
- }
-
- if (featureVersion == null)
- return createError("The \"featureVersion\" parameter is missing from the \"install feature\" action"); //$NON-NLS-1$
- else if (PARM_DEFAULT_VALUE.equals(featureVersion)) {
- featureVersion = artifactKey.getVersion().toString();
- }
-
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- File file = Util.getBundleFile(artifactKey, profile);
- if (file == null || !file.exists()) {
- // todo
- }
- return configuration.addFeatureEntry(file, featureId, featureVersion, artifactKey.getId(), artifactKey.getVersion().toString(), /*primary*/false, /*application*/null, /*root*/null);
- }
-
- protected IStatus uninstallFeature(Map parameters) {
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(PARM_PLATFORM_CONFIGURATION);
- String feature = (String) parameters.get(PARM_FEATURE);
- String featureId = (String) parameters.get(PARM_FEATURE_ID);
- String featureVersion = (String) parameters.get(PARM_FEATURE_VERSION);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit for eclipse feature contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(feature)) {
- artifactKey = artifacts[i];
- break;
- }
- }
-
- if (featureId == null)
- return createError("The \"featureId\" parameter is missing from the \"uninstall feature\" action"); //$NON-NLS-1$
- else if (PARM_DEFAULT_VALUE.equals(featureId)) {
- featureId = artifactKey.getId();
- }
-
- if (featureVersion == null)
- return createError("The \"featureVersion\" parameter is missing from the \"install feature\" action"); //$NON-NLS-1$
- else if (PARM_DEFAULT_VALUE.equals(featureVersion)) {
- featureVersion = artifactKey.getVersion().toString();
- }
-
- return configuration.removeFeatureEntry(featureId, featureVersion);
- }
-
private IInstallableUnit prepareIU(IInstallableUnit iu, IProfile profile) {
Class c = null;
@@ -931,7 +126,7 @@ public class EclipseTouchpoint extends Touchpoint {
if (c != null)
c = Class.forName("org.eclipse.osgi.service.resolver.PlatformAdmin"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
- throw new IllegalStateException("The mock IU could not be updated. Generator not available: " + e.getMessage()); //$NON-NLS-1$
+ throw new IllegalStateException(NLS.bind(Messages.generator_not_available, e.getMessage()));
}
if (c != null) {
@@ -943,78 +138,27 @@ public class EclipseTouchpoint extends Touchpoint {
if (artifactKey == null)
return iu;
- File bundleFile = Util.getBundleFile(artifactKey, profile);
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null) {
+ LogHelper.log(Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey.toString())));
+ return null;
+ }
return MetadataGeneratorUtils.createBundleIU(artifactKey, bundleFile);
}
// should not occur
- throw new IllegalStateException("Unexpected Exception: prepareIU"); //$NON-NLS-1$
+ throw new IllegalStateException("Unexpected state: prepareIU"); //$NON-NLS-1$
}
- IStatus addSourceBundle(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- SourceManipulator manipulator = (SourceManipulator) parameters.get(PARM_SOURCE_BUNDLES);
- String bundleId = (String) parameters.get(PARM_BUNDLE);
- if (bundleId == null)
- return createError("The \"bundleId\" parameter is missing from the \"add source bundle\" action"); //$NON-NLS-1$
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
- break;
- }
- }
- if (artifactKey == null)
- throw new IllegalArgumentException("No artifact found that matches: " + bundleId); //$NON-NLS-1$
-
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " to install was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- manipulator.addBundle(bundleFile, artifactKey.getId(), artifactKey.getVersion());
- } catch (IOException e) {
- createError("Can't configure " + artifactKey.toString() + " as a source bundle.", e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return Status.OK_STATUS;
- }
-
- IStatus removeSourceBundle(Map parameters) {
- IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
- SourceManipulator manipulator = (SourceManipulator) parameters.get(PARM_SOURCE_BUNDLES);
- String bundleId = (String) parameters.get(PARM_BUNDLE);
- if (bundleId == null)
- return createError("The \"bundleId\" parameter is missing from the \"remove source bundle\" action"); //$NON-NLS-1$
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return createError("Installable unit contains no artifacts"); //$NON-NLS-1$
-
- IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
- break;
- }
- }
- if (artifactKey == null)
- throw new IllegalArgumentException("No artifact found that matches: " + bundleId); //$NON-NLS-1$
-
- File bundleFile = Util.getBundleFile(artifactKey, profile);
- if (bundleFile == null || !bundleFile.exists())
- return createError("The artifact " + artifactKey.toString() + " to install was not found."); //$NON-NLS-1$ //$NON-NLS-2$
-
+ public static IStatus loadManipulator(Manipulator manipulator) {
try {
- manipulator.removeBundle(bundleFile);
+ manipulator.load();
+ } catch (IllegalStateException e) {
+ return Util.createError(Messages.error_loading_manipulator);
+ } catch (FrameworkAdminRuntimeException e) {
+ return Util.createError(Messages.error_loading_manipulator);
} catch (IOException e) {
- createError("Can't configure " + artifactKey.toString() + " as a source bundle.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ return Util.createError(Messages.error_loading_manipulator);
}
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
index 30aa55db1..4da476d3f 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
@@ -14,13 +14,18 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.messages"; //$NON-NLS-1$
+ public static String error_loading_manipulator;
+ public static String BundlePool;
+ public static String failed_prepareIU;
+ public static String error_saving_manipulator;
+ public static String error_saving_platform_configuration;
+ public static String error_saving_source_bundles_list;
+ public static String error_constructing_platform_configuration_url;
+ public static String generator_not_available;
+ public static String artifact_file_not_found;
static {
// load message values from bundle file and assign to fields below
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
-
- public static String error_loading_manipulator;
- public static String BundlePool;
-
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
index fcead9bbd..284596369 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
@@ -41,15 +41,15 @@ public class Util {
private static final String CACHE_EXTENSIONS = "org.eclipse.equinox.p2.cache.extensions"; //$NON-NLS-1$
private static final String PIPE = "|"; //$NON-NLS-1$
- static AgentLocation getAgentLocation() {
+ public static AgentLocation getAgentLocation() {
return (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
}
- static IArtifactRepositoryManager getArtifactRepositoryManager() {
+ public static IArtifactRepositoryManager getArtifactRepositoryManager() {
return (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
}
- static URL getBundlePoolLocation(IProfile profile) {
+ public static URL getBundlePoolLocation(IProfile profile) {
String path = profile.getProperty(IProfile.PROP_CACHE);
if (path != null)
try {
@@ -84,7 +84,7 @@ public class Util {
}
}
- static IFileArtifactRepository getAggregatedBundleRepository(IProfile profile) {
+ public static IFileArtifactRepository getAggregatedBundleRepository(IProfile profile) {
Set bundleRepositories = new HashSet();
bundleRepositories.add(Util.getBundlePoolRepository(profile));
@@ -119,7 +119,7 @@ public class Util {
return listProperty;
}
- static BundleInfo createBundleInfo(File bundleFile, String manifest) {
+ public static BundleInfo createBundleInfo(File bundleFile, String manifest) {
BundleInfo bundleInfo = new BundleInfo();
try {
if (bundleFile != null)
@@ -148,24 +148,24 @@ public class Util {
return bundleInfo;
}
- static File getBundleFile(IArtifactKey artifactKey, IProfile profile) {
+ public static File getArtifactFile(IArtifactKey artifactKey, IProfile profile) {
IFileArtifactRepository aggregatedView = getAggregatedBundleRepository(profile);
File bundleJar = aggregatedView.getArtifactFile(artifactKey);
return bundleJar;
}
- static File getConfigurationFolder(IProfile profile) {
+ public static File getConfigurationFolder(IProfile profile) {
String config = profile.getProperty(CONFIG_FOLDER);
if (config != null)
return new File(config);
return new File(getInstallFolder(profile), "configuration"); //$NON-NLS-1$
}
- static File getInstallFolder(IProfile profile) {
+ public static File getInstallFolder(IProfile profile) {
return new File(profile.getProperty(IProfile.PROP_INSTALL_FOLDER));
}
- static File getLauncherPath(IProfile profile) {
+ public static File getLauncherPath(IProfile profile) {
return new File(getInstallFolder(profile), getLauncherName(profile));
}
@@ -205,7 +205,7 @@ public class Util {
return null;
}
- static String getManifest(TouchpointData[] data) {
+ public static String getManifest(TouchpointData[] data) {
for (int i = 0; i < data.length; i++) {
String manifest = data[i].getInstructions("manifest"); //$NON-NLS-1$
if (manifest != null && manifest.length() > 0)
@@ -221,7 +221,7 @@ public class Util {
* If the agent location is not a sub-directory of the configuration folder, this
* method simply returns the absolute agent location expressed as a URL.
*/
- static String computeRelativeAgentLocation(IProfile profile) {
+ public static String computeRelativeAgentLocation(IProfile profile) {
URL agentURL = Util.getAgentLocation().getURL();
//TODO handle proper path/url conversion
IPath agentPath = new Path(agentURL.getPath());
@@ -233,4 +233,12 @@ public class Util {
return agentURL.toString();
}
+ public static IStatus createError(String message) {
+ return createError(message, null);
+ }
+
+ public static IStatus createError(String message, Exception e) {
+ return new Status(IStatus.ERROR, Activator.ID, message, e);
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
new file mode 100644
index 000000000..d89861bbf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+public class ActionConstants {
+
+ public static final String PARM_ARTIFACT = "@artifact"; //$NON-NLS-1$
+ public static final String PARM_ARTIFACT_REQUESTS = "artifactRequests"; //$NON-NLS-1$
+ public static final String PARM_BUNDLE = "bundle"; //$NON-NLS-1$
+ public static final String PARM_FEATURE = "feature"; //$NON-NLS-1$
+ public static final String PARM_FEATURE_ID = "featureId"; //$NON-NLS-1$
+ public static final String PARM_FEATURE_VERSION = "featureVersion"; //$NON-NLS-1$
+ public static final String PARM_JVM_ARG = "jvmArg"; //$NON-NLS-1$
+ public static final String PARM_OPERAND = "operand"; //$NON-NLS-1$
+ public static final String PARM_PREVIOUS_START_LEVEL = "previousStartLevel"; //$NON-NLS-1$
+ public static final String PARM_PREVIOUS_STARTED = "previousStarted"; //$NON-NLS-1$
+ public static final String PARM_PREVIOUS_VALUE = "previousValue"; //$NON-NLS-1$
+ public static final String PARM_PROFILE = "profile"; //$NON-NLS-1$
+ public static final String PARM_PROGRAM_ARG = "programArg"; //$NON-NLS-1$
+ public static final String PARM_PROP_NAME = "propName"; //$NON-NLS-1$
+ public static final String PARM_PROP_VALUE = "propValue"; //$NON-NLS-1$
+ public static final String PARM_START_LEVEL = "startLevel"; //$NON-NLS-1$
+ public static final String PARM_STARTED = "started"; //$NON-NLS-1$
+ public static final String PARM_DEFAULT_VALUE = "default"; //$NON-NLS-1$
+ public static final String PARM_LAUNCHERNAME = "name"; //$NON-NLS-1$
+ public static final String PARM_PATH = "path"; //$NON-NLS-1$
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java
new file mode 100644
index 000000000..07c6fb886
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class ActionFactory {
+
+ private static Map actions;
+
+ static {
+ actions = new HashMap();
+ actions.put(CollectAction.ID, CollectAction.class);
+ actions.put(InstallBundleAction.ID, InstallBundleAction.class);
+ actions.put(UninstallBundleAction.ID, UninstallBundleAction.class);
+ actions.put(AddSourceBundleAction.ID, AddSourceBundleAction.class);
+ actions.put(RemoveSourceBundleAction.ID, RemoveSourceBundleAction.class);
+ actions.put(InstallFeatureAction.ID, InstallFeatureAction.class);
+ actions.put(UninstallFeatureAction.ID, UninstallFeatureAction.class);
+ actions.put(SetLauncherNameAction.ID, SetLauncherNameAction.class);
+ actions.put(AddProgramArgumentAction.ID, AddProgramArgumentAction.class);
+ actions.put(RemoveProgramArgumentAction.ID, RemoveProgramArgumentAction.class);
+ actions.put(SetStartLevelAction.ID, SetStartLevelAction.class);
+ actions.put(MarkStartedAction.ID, MarkStartedAction.class);
+ actions.put(SetFrameworkDependentPropertyAction.ID, SetFrameworkDependentPropertyAction.class);
+ actions.put(SetFrameworkIndependentPropertyAction.ID, SetFrameworkIndependentPropertyAction.class);
+ actions.put(SetProgramPropertyAction.ID, SetProgramPropertyAction.class);
+ actions.put(AddJVMArgumentAction.ID, AddJVMArgumentAction.class);
+ actions.put(RemoveJVMArgumentAction.ID, RemoveJVMArgumentAction.class);
+ actions.put(MkdirAction.ID, MkdirAction.class);
+ actions.put(RmdirAction.ID, RmdirAction.class);
+ }
+
+ public static ProvisioningAction create(String actionId) {
+ Class clazz = (Class) actions.get(actionId);
+ if (clazz != null) {
+ try {
+ return (ProvisioningAction) clazz.newInstance();
+ } catch (InstantiationException e) {
+ LogHelper.log(Util.createError(NLS.bind(Messages.action_not_instantiated, actionId), e));
+ return null;
+ } catch (IllegalAccessException e) {
+ LogHelper.log(Util.createError(NLS.bind(Messages.action_not_instantiated, actionId), e));
+ return null;
+ }
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java
new file mode 100644
index 000000000..be5c221ef
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class AddJVMArgumentAction extends ProvisioningAction {
+ public static final String ID = "addJvmArg"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
+ if (jvmArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
+ manipulator.getLauncherData().addJvmArg(jvmArg);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
+ if (jvmArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
+ manipulator.getLauncherData().removeJvmArg(jvmArg);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
new file mode 100644
index 000000000..27f9bcc3a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class AddProgramArgumentAction extends ProvisioningAction {
+ public static final String ID = "addProgramArg"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
+ if (programArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
+
+ if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+
+ File fileLocation = Util.getArtifactFile(artifactKey, profile);
+ if (fileLocation == null || !fileLocation.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+ programArg = fileLocation.getAbsolutePath();
+ }
+
+ manipulator.getLauncherData().addProgramArg(programArg);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
+ if (programArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
+
+ if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+
+ File fileLocation = Util.getArtifactFile(artifactKey, profile);
+ if (fileLocation == null || !fileLocation.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+ programArg = fileLocation.getAbsolutePath();
+ }
+
+ manipulator.getLauncherData().removeProgramArg(programArg);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java
new file mode 100644
index 000000000..2f90c6aaa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class AddSourceBundleAction extends ProvisioningAction {
+ public static final String ID = "addSourceBundle"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return AddSourceBundleAction.addSourceBundle(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return RemoveSourceBundleAction.removeSourceBundle(parameters);
+ }
+
+ public static IStatus addSourceBundle(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ SourceManipulator manipulator = (SourceManipulator) parameters.get(EclipseTouchpoint.PARM_SOURCE_BUNDLES);
+ String bundleId = (String) parameters.get(ActionConstants.PARM_BUNDLE);
+ if (bundleId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(bundleId)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+ if (artifactKey == null)
+ throw new IllegalArgumentException(NLS.bind(Messages.no_matching_artifact, bundleId));
+
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ try {
+ manipulator.addBundle(bundleFile, artifactKey.getId(), artifactKey.getVersion());
+ } catch (IOException e) {
+ return Util.createError(NLS.bind(Messages.cannot_configure_source_bundle, artifactKey));
+ }
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java
new file mode 100644
index 000000000..ab8e52783
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.*;
+import org.eclipse.equinox.internal.provisional.p2.metadata.*;
+
+public class CollectAction extends ProvisioningAction {
+ public static final String ID = "collect"; //$NON-NLS-1$
+ public static final String ARTIFACT_FOLDER = "artifact.folder"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(ActionConstants.PARM_OPERAND);
+ IArtifactRequest[] requests = CollectAction.collect(operand.second(), profile);
+
+ Collection artifactRequests = (Collection) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS);
+ artifactRequests.add(requests);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ // nothing to do for now
+ return Status.OK_STATUS;
+ }
+
+ public static boolean isZipped(TouchpointData[] data) {
+ if (data == null || data.length == 0)
+ return false;
+ for (int i = 0; i < data.length; i++) {
+ if (data[i].getInstructions("zipped") != null) //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+ public static Properties createArtifactDescriptorProperties(IInstallableUnit installableUnit) {
+ Properties descriptorProperties = null;
+ if (CollectAction.isZipped(installableUnit.getTouchpointData())) {
+ descriptorProperties = new Properties();
+ descriptorProperties.setProperty(CollectAction.ARTIFACT_FOLDER, Boolean.TRUE.toString());
+ }
+ return descriptorProperties;
+ }
+
+ // TODO: Here we may want to consult multiple caches
+ public static IArtifactRequest[] collect(IInstallableUnit installableUnit, IProfile profile) {
+ IArtifactKey[] toDownload = installableUnit.getArtifacts();
+ if (toDownload == null || toDownload.length == 0)
+ return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
+
+ IArtifactRepository aggregatedRepositoryView = Util.getAggregatedBundleRepository(profile);
+ IArtifactRepository bundlePool = Util.getBundlePoolRepository(profile);
+ List requests = new ArrayList();
+ for (int i = 0; i < toDownload.length; i++) {
+ IArtifactKey key = toDownload[i];
+ if (!aggregatedRepositoryView.contains(key)) {
+ Properties repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit);
+ requests.add(Util.getArtifactRepositoryManager().createMirrorRequest(key, bundlePool, null, repositoryProperties));
+ }
+ }
+
+ if (requests.isEmpty())
+ return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
+
+ IArtifactRequest[] result = (IArtifactRequest[]) requests.toArray(new IArtifactRequest[requests.size()]);
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java
new file mode 100644
index 000000000..ebfc1240f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class InstallBundleAction extends ProvisioningAction {
+ public static final String ID = "installBundle"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return InstallBundleAction.installBundle(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return UninstallBundleAction.uninstallBundle(parameters);
+ }
+
+ public static IStatus installBundle(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String bundleId = (String) parameters.get(ActionConstants.PARM_BUNDLE);
+ if (bundleId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
+
+ //TODO: eventually remove this. What is a fragment doing here??
+ if (iu.isFragment()) {
+ System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$
+ return Status.OK_STATUS;
+ }
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(bundleId)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+ if (artifactKey == null)
+ throw new IllegalArgumentException(NLS.bind(Messages.no_matching_artifact, bundleId));
+
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ //By now we always have the manifest in the touchpoint data
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ manipulator.getConfigData().addBundle(bundleInfo);
+
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java
new file mode 100644
index 000000000..b1b78e038
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class InstallFeatureAction extends ProvisioningAction {
+ public static final String ID = "installFeature"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return InstallFeatureAction.installFeature(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return UninstallFeatureAction.uninstallFeature(parameters);
+ }
+
+ public static IStatus installFeature(Map parameters) {
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION);
+ String feature = (String) parameters.get(ActionConstants.PARM_FEATURE);
+ String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID);
+ String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION);
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(feature)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+
+ if (featureId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_FEATURE_ID, ID));
+ else if (ActionConstants.PARM_DEFAULT_VALUE.equals(featureId)) {
+ featureId = artifactKey.getId();
+ }
+
+ if (featureVersion == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_FEATURE_VERSION, ID));
+ else if (ActionConstants.PARM_DEFAULT_VALUE.equals(featureVersion)) {
+ featureVersion = artifactKey.getVersion().toString();
+ }
+
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ File file = Util.getArtifactFile(artifactKey, profile);
+ if (file == null || !file.exists()) {
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+ }
+ return configuration.addFeatureEntry(file, featureId, featureVersion, artifactKey.getId(), artifactKey.getVersion().toString(), /*primary*/false, /*application*/null, /*root*/null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java
new file mode 100644
index 000000000..394608ea3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class MarkStartedAction extends ProvisioningAction {
+ public static final String ID = "markStarted"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ String started = (String) parameters.get(ActionConstants.PARM_STARTED);
+ if (started == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_STARTED, ID));
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+
+ BundleInfo[] bundles = manipulator.getConfigData().getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ if (bundles[i].equals(bundleInfo)) {
+ getMemento().put(ActionConstants.PARM_PREVIOUS_STARTED, new Boolean(bundles[i].isMarkedAsStarted()));
+ bundles[i].setMarkedAsStarted(Boolean.valueOf(started).booleanValue());
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+
+ BundleInfo[] bundles = manipulator.getConfigData().getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ if (bundles[i].equals(bundleInfo)) {
+ Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED);
+ if (previousStarted != null)
+ bundles[i].setMarkedAsStarted(previousStarted.booleanValue());
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java
new file mode 100644
index 000000000..dbeb1e7d9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.messages"; //$NON-NLS-1$
+ public static String artifact_file_not_found;
+ public static String action_not_instantiated;
+ public static String parameter_not_set;
+ public static String iu_contains_no_arifacts;
+ public static String no_matching_artifact;
+ public static String missing_manifest;
+ public static String failed_bundleinfo;
+ public static String cannot_configure_source_bundle;
+ public static String error_parsing_startlevel;
+
+ static {
+ // load message values from bundle file and assign to fields below
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MkdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MkdirAction.java
new file mode 100644
index 000000000..bdf2e0f01
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MkdirAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class MkdirAction extends ProvisioningAction {
+ public static final String ID = "mkdir"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ String path = (String) parameters.get(ActionConstants.PARM_PATH);
+ if (path == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PATH, ID));
+ new File(path).mkdir();
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ String path = (String) parameters.get(ActionConstants.PARM_PATH);
+ if (path == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PATH, ID));
+ new File(path).delete();
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java
new file mode 100644
index 000000000..fd2815ed7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class RemoveJVMArgumentAction extends ProvisioningAction {
+ public static final String ID = "removeJvmArg"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
+ if (jvmArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
+ manipulator.getLauncherData().removeJvmArg(jvmArg);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
+ if (jvmArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
+ manipulator.getLauncherData().addJvmArg(jvmArg);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
new file mode 100644
index 000000000..7f939338a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class RemoveProgramArgumentAction extends ProvisioningAction {
+ public static final String ID = "removeProgramArg"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
+ if (programArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
+
+ if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+
+ File fileLocation = Util.getArtifactFile(artifactKey, profile);
+ if (fileLocation == null || !fileLocation.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+ programArg = fileLocation.getAbsolutePath();
+ }
+
+ manipulator.getLauncherData().removeProgramArg(programArg);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
+ if (programArg == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
+
+ if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+
+ File fileLocation = Util.getArtifactFile(artifactKey, profile);
+ if (fileLocation == null || !fileLocation.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+ programArg = fileLocation.getAbsolutePath();
+ }
+
+ manipulator.getLauncherData().addProgramArg(programArg);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java
new file mode 100644
index 000000000..89c0b93a1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class RemoveSourceBundleAction extends ProvisioningAction {
+ public static final String ID = "removeSourceBundle"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return RemoveSourceBundleAction.removeSourceBundle(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return AddSourceBundleAction.addSourceBundle(parameters);
+ }
+
+ public static IStatus removeSourceBundle(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ SourceManipulator manipulator = (SourceManipulator) parameters.get(EclipseTouchpoint.PARM_SOURCE_BUNDLES);
+ String bundleId = (String) parameters.get(ActionConstants.PARM_BUNDLE);
+ if (bundleId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(bundleId)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+ if (artifactKey == null)
+ throw new IllegalArgumentException(NLS.bind(Messages.no_matching_artifact, bundleId));
+
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ try {
+ manipulator.removeBundle(bundleFile);
+ } catch (IOException e) {
+ return Util.createError(NLS.bind(Messages.cannot_configure_source_bundle, artifactKey));
+ }
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RmdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RmdirAction.java
new file mode 100644
index 000000000..41dc37cde
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RmdirAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class RmdirAction extends ProvisioningAction {
+ public static final String ID = "rmdir"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ String path = (String) parameters.get(ActionConstants.PARM_PATH);
+ if (path == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PATH, ID));
+ new File(path).delete();
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ String path = (String) parameters.get(ActionConstants.PARM_PATH);
+ if (path == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PATH, ID));
+ new File(path).mkdir();
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkDependentPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkDependentPropertyAction.java
new file mode 100644
index 000000000..b2d980f60
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkDependentPropertyAction.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class SetFrameworkDependentPropertyAction extends ProvisioningAction {
+ public static final String ID = "setFwDependentProp"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE);
+ if (propValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_VALUE, ID));
+ getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
+ manipulator.getConfigData().setFwDependentProp(propName, propValue);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String previousValue = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE);
+ if (previousValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PREVIOUS_VALUE, ID));
+ manipulator.getConfigData().setFwDependentProp(propName, previousValue);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkIndependentPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkIndependentPropertyAction.java
new file mode 100644
index 000000000..c93ff5c73
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetFrameworkIndependentPropertyAction.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class SetFrameworkIndependentPropertyAction extends ProvisioningAction {
+ public static final String ID = "setFwIndependentProp"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE);
+ if (propValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_VALUE, ID));
+ getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
+ manipulator.getConfigData().setFwIndependentProp(propName, propValue);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String previousValue = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE);
+ if (previousValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PREVIOUS_VALUE, ID));
+ manipulator.getConfigData().setFwIndependentProp(propName, previousValue);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java
new file mode 100644
index 000000000..c2e869ec8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.engine.Profile;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+
+public class SetLauncherNameAction extends ProvisioningAction {
+ public static final String ID = "setLauncherName"; //$NON-NLS-1$
+
+ private IStatus changeName(String newName, Manipulator manipulator, Profile profile) {
+ //force the load to make sure we read the values in the old filename
+ IStatus status = EclipseTouchpoint.loadManipulator(manipulator);
+ if (status != null && !status.isOK())
+ return status;
+ getMemento().put(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME));
+ profile.setProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, newName);
+ manipulator.getLauncherData().setLauncher(Util.getLauncherPath(profile));
+ return Status.OK_STATUS;
+ }
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE);
+ return changeName((String) parameters.get(ActionConstants.PARM_LAUNCHERNAME), manipulator, profile);
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE);
+ return changeName((String) getMemento().get(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME), manipulator, profile);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java
new file mode 100644
index 000000000..2e6529384
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class SetProgramPropertyAction extends ProvisioningAction {
+ public static final String ID = "setProgramProperty"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE);
+ if (propValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_VALUE, ID));
+ getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getFwDependentProp(propName));
+ manipulator.getConfigData().setFwDependentProp(propName, propValue);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
+ if (propName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID));
+ String previousValue = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE);
+ if (previousValue == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PREVIOUS_VALUE, ID));
+ manipulator.getConfigData().setFwDependentProp(propName, previousValue);
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java
new file mode 100644
index 000000000..9bed130c2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class SetStartLevelAction extends ProvisioningAction {
+ public static final String ID = "setStartLevel"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ String startLevel = (String) parameters.get(ActionConstants.PARM_START_LEVEL);
+ if (startLevel == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_START_LEVEL, ID));
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+
+ BundleInfo[] bundles = manipulator.getConfigData().getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ if (bundles[i].equals(bundleInfo)) {
+ getMemento().put(ActionConstants.PARM_PREVIOUS_START_LEVEL, new Integer(bundles[i].getStartLevel()));
+ try {
+ bundles[i].setStartLevel(Integer.parseInt(startLevel));
+ } catch (NumberFormatException e) {
+ return Util.createError(NLS.bind(Messages.error_parsing_startlevel, startLevel, bundles[i].getSymbolicName()), e);
+ }
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = artifacts[0];
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+ if (bundleFile == null || !bundleFile.exists())
+ return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
+
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+
+ BundleInfo[] bundles = manipulator.getConfigData().getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ if (bundles[i].equals(bundleInfo)) {
+ Integer previousStartLevel = (Integer) getMemento().get(ActionConstants.PARM_PREVIOUS_START_LEVEL);
+ if (previousStartLevel != null)
+ bundles[i].setStartLevel(previousStartLevel.intValue());
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java
new file mode 100644
index 000000000..daf1ec901
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class UninstallBundleAction extends ProvisioningAction {
+ public static final String ID = "uninstallBundle"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return UninstallBundleAction.uninstallBundle(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return InstallBundleAction.installBundle(parameters);
+ }
+
+ public static IStatus uninstallBundle(Map parameters) {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
+ String bundleId = (String) parameters.get(ActionConstants.PARM_BUNDLE);
+ if (bundleId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
+
+ //TODO: eventually remove this. What is a fragment doing here??
+ if (iu.isFragment()) {
+ System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$
+ return Status.OK_STATUS;
+ }
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(bundleId)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+ if (artifactKey == null)
+ throw new IllegalArgumentException(NLS.bind(Messages.no_matching_artifact, bundleId));
+
+ // the bundleFile might be null here, that's OK.
+ File bundleFile = Util.getArtifactFile(artifactKey, profile);
+
+ String manifest = Util.getManifest(iu.getTouchpointData());
+ if (manifest == null)
+ return Util.createError(NLS.bind(Messages.missing_manifest, iu));
+
+ BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, manifest);
+ if (bundleInfo == null)
+ return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ manipulator.getConfigData().removeBundle(bundleInfo);
+
+ return Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java
new file mode 100644
index 000000000..95ea30f15
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class UninstallFeatureAction extends ProvisioningAction {
+ public static final String ID = "uninstallFeature"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ return UninstallFeatureAction.uninstallFeature(parameters);
+ }
+
+ public IStatus undo(Map parameters) {
+ return InstallFeatureAction.installFeature(parameters);
+ }
+
+ public static IStatus uninstallFeature(Map parameters) {
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION);
+ String feature = (String) parameters.get(ActionConstants.PARM_FEATURE);
+ String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID);
+ String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION);
+
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
+
+ IArtifactKey artifactKey = null;
+ for (int i = 0; i < artifacts.length; i++) {
+ if (artifacts[i].toString().equals(feature)) {
+ artifactKey = artifacts[i];
+ break;
+ }
+ }
+
+ if (featureId == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_FEATURE_ID, ID));
+ else if (ActionConstants.PARM_DEFAULT_VALUE.equals(featureId)) {
+ featureId = artifactKey.getId();
+ }
+
+ if (featureVersion == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_FEATURE_VERSION, ID));
+ else if (ActionConstants.PARM_DEFAULT_VALUE.equals(featureVersion)) {
+ featureVersion = artifactKey.getVersion().toString();
+ }
+
+ return configuration.removeFeatureEntry(featureId, featureVersion);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
new file mode 100644
index 000000000..f8551dea0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2008 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+artifact_file_not_found=The artifact file for {0} was not found.
+action_not_instantiated=Action could not be instantiated for action id: {0}.
+parameter_not_set=The \"{0}\" parameter was not set in the \"{1}\" action.
+iu_contains_no_arifacts=Installable unit contains no artifacts: {0}.
+no_matching_artifact=No matching artifact found for: {0}.
+missing_manifest=The manifest is missing for: {0}.
+failed_bundleinfo=Failed to create bundleInfo for: {0}.
+cannot_configure_source_bundle=Cannot configure {0} as a source bundle.
+error_parsing_startlevel=Error parsing start level: {0} for bundle: {1}. \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
index 91e637472..099b62640 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
@@ -10,7 +10,11 @@
###############################################################################
error_loading_manipulator=Error while loading manipulator.
-
-
-
+failed_prepareIU=Failed to prepare partial IU: {0}.
+error_saving_manipulator=Error saving manipulator.
+error_saving_platform_configuration=Error saving platform configuration.
+error_saving_source_bundles_list=Error saving source bundles list.
+error_constructing_platform_configuration_url=Error constructing platform configuration url.
+generator_not_available=The partial IU could not be updated. Generator not available: {0}.
+artifact_file_not_found=The artifact file for {0} was not found.
BundlePool=Bundle pool

Back to the top