Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodor Boev2017-05-05 14:31:12 +0000
committerAlexander Kurtakov2017-08-22 15:08:09 +0000
commit61831a9c11d659850dea2a43d1e8bcfcea4d12a8 (patch)
treecd68424772e91cd82f95978104f3a2ddd4a1986e /bundles/org.eclipse.equinox.p2.touchpoint.eclipse
parent26f5272312c172e0c957f4bbdb4adff894490e2f (diff)
downloadrt.equinox.p2-61831a9c11d659850dea2a43d1e8bcfcea4d12a8.tar.gz
rt.equinox.p2-61831a9c11d659850dea2a43d1e8bcfcea4d12a8.tar.xz
rt.equinox.p2-61831a9c11d659850dea2a43d1e8bcfcea4d12a8.zip
Bug 486279 - Changed missing entry status to warning
Converted the errors caused by missing entries in bundles.info to warnings. This keeps the actions backward compatible. For some of the actions is makes sense as well. E.g. uninstall should be idempotent Refactored UninstallBundleAction to relay on Util.findBundleInfo() to find the entry in bundles.info, rather than to try to re-construct the BundleInfo from other data and use Object.equals() Change-Id: I902a5b209b1ff6a764e6c8f0569926c97ed8b3c5 Signed-off-by: Todor Boev <rinsvind@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties3
7 files changed, 25 insertions, 35 deletions
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 0f803ccdd..ba7a96999 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
@@ -344,6 +344,14 @@ public class Util {
return new Status(IStatus.ERROR, Activator.ID, message, e);
}
+ public static IStatus createWarning(String message) {
+ return createWarning(message, null);
+ }
+
+ public static IStatus createWarning(String message, Exception e) {
+ return new Status(IStatus.WARNING, Activator.ID, message, e);
+ }
+
public static File getLauncherConfigLocation(IProfile profile) {
String launcherConfig = profile.getProperty(IProfile.PROP_LAUNCHER_CONFIGURATION);
return launcherConfig == null ? null : new File(launcherConfig);
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
index 4a2ecfe99..040e4db3a 100644
--- 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
@@ -71,7 +71,7 @@ public class InstallBundleAction extends ProvisioningAction {
BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, iu);
if (bundleInfo == null)
- return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ return Util.createError(NLS.bind(Messages.failed_create_bundleinfo, iu));
manipulator.getConfigData().addBundle(bundleInfo);
return Status.OK_STATUS;
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
index 0b1814cd6..e0f69eb59 100644
--- 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
@@ -35,7 +35,7 @@ public class MarkStartedAction extends ProvisioningAction {
// Changes to this object will be reflected in the backing runtime configuration store
BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu);
if (bundleInfo == null) {
- return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu));
}
// Bundle fragments are not started
@@ -60,7 +60,7 @@ public class MarkStartedAction extends ProvisioningAction {
// Changes to this object will be reflected in the backing runtime configuration store
BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu);
if (bundleInfo == null) {
- return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu));
}
bundleInfo.setMarkedAsStarted(previousStarted.booleanValue());
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
index 7e8bddf77..83097d5f8 100644
--- 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
@@ -19,7 +19,8 @@ public class Messages extends NLS {
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 failed_create_bundleinfo;
+ public static String failed_find_bundleinfo;
public static String cannot_configure_source_bundle;
public static String error_parsing_startlevel;
public static String artifact_not_directory;
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
index e575e954c..ae9c58bbb 100644
--- 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
@@ -34,8 +34,9 @@ public class SetStartLevelAction extends ProvisioningAction {
// Changes to this object will be reflected in the backing runtime configuration store
BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu);
- if (bundleInfo == null)
- return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ if (bundleInfo == null) {
+ return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu));
+ }
// Bundle fragments are not started
if (bundleInfo.getFragmentHost() != null) {
@@ -62,7 +63,7 @@ public class SetStartLevelAction extends ProvisioningAction {
// Changes to this object will be reflected in the backing runtime configuration store
BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu);
if (bundleInfo == null) {
- return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu));
+ return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu));
}
bundleInfo.setStartLevel(previousStartLevel.intValue());
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
index a20aae951..d652d42a9 100644
--- 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
@@ -8,8 +8,6 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
-import java.io.File;
-import java.util.Collection;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -17,10 +15,7 @@ import org.eclipse.equinox.frameworkadmin.BundleInfo;
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.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.osgi.util.NLS;
@@ -37,13 +32,12 @@ public class UninstallBundleAction extends ProvisioningAction {
}
public static IStatus uninstallBundle(Map<String, Object> parameters) {
- IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
- 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)
+ 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 (QueryUtil.isFragment(iu)) {
@@ -51,28 +45,13 @@ public class UninstallBundleAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- Collection<IArtifactKey> artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.isEmpty())
- return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
-
- IArtifactKey artifactKey = null;
- for (IArtifactKey candidate : artifacts) {
- if (candidate.toString().equals(bundleId)) {
- artifactKey = candidate;
- break;
- }
+ // Changes to this object will be reflected in the backing runtime configuration store
+ BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu);
+ if (bundleInfo == null) {
+ return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu));
}
- 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(agent, artifactKey, profile);
-
- BundleInfo bundleInfo = Util.createBundleInfo(bundleFile, iu);
- 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/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
index 74c1907e1..af38f9b91 100644
--- 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
@@ -15,7 +15,8 @@ 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}.
+failed_create_bundleinfo=Failed to create bundleInfo for: {0}.
+failed_find_bundleinfo=Failed to find a configured 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_bundle_pool=No bundle pool defined for profile: {0}.

Back to the top