Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2009-03-17 21:36:04 +0000
committerDJ Houghton2009-03-17 21:36:04 +0000
commit49f64c70a65f9f62f1880e2f5f3d814d1729b601 (patch)
tree3f33806b833d08491b981c36e2554c9b96eef139 /bundles
parent4882e746a864c7ae0aaf13af75a2c0e6fa32502a (diff)
downloadrt.equinox.p2-49f64c70a65f9f62f1880e2f5f3d814d1729b601.tar.gz
rt.equinox.p2-49f64c70a65f9f62f1880e2f5f3d814d1729b601.tar.xz
rt.equinox.p2-49f64c70a65f9f62f1880e2f5f3d814d1729b601.zip
Bug 268185 - Director Application destination problems
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties4
3 files changed, 30 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
index 8f02b8bbc..ac2616fb8 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
@@ -74,6 +74,7 @@ public class Application implements IApplication {
private boolean roamingProfile = false;
private IPlanner planner;
private IEngine engine;
+ private boolean noProfileId = false;
private int command = -1;
@@ -127,8 +128,10 @@ public class Application implements IApplication {
}
private IProfile initializeProfile() throws CoreException {
- if (profileId == null)
+ if (profileId == null) {
profileId = IProfileRegistry.SELF;
+ noProfileId = true;
+ }
IProfile profile = ProvisioningHelper.getProfile(profileId);
if (profile == null) {
if (destination == null)
@@ -400,9 +403,14 @@ public class Application implements IApplication {
System.out.println(NLS.bind(Messages.Missing_IU, root));
return EXIT_ERROR;
}
- if (!updateRoamingProperties(profile).isOK()) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Cant_change_roaming, profile.getProfileId())));
- System.out.println(NLS.bind(Messages.Cant_change_roaming, profile.getProfileId()));
+ // keep this result status in case there is a problem so we can report it to the user
+ IStatus updateRoamStatus = updateRoamingProperties(profile);
+ if (!updateRoamStatus.isOK()) {
+ MultiStatus multi = new MultiStatus(Activator.ID, IStatus.ERROR, NLS.bind(Messages.Cant_change_roaming, profile.getProfileId()), null);
+ multi.add(updateRoamStatus);
+ LogHelper.log(multi);
+ System.out.println(multi.getMessage());
+ System.out.println(updateRoamStatus.getMessage());
return EXIT_ERROR;
}
ProvisioningContext context = new ProvisioningContext(metadataRepositoryLocations);
@@ -528,9 +536,22 @@ public class Application implements IApplication {
}
private IStatus updateRoamingProperties(IProfile profile) {
- ProfileChangeRequest request = new ProfileChangeRequest(profile);
+ // if the user didn't specify a destination path on the command-line
+ // then we assume they are installing into the currently running
+ // instance and we don't have anything to update
+ if (destination == null)
+ return Status.OK_STATUS;
+
+ // if the user didn't set a profile id on the command-line this is ok if they
+ // also didn't set the destination path. (handled in the case above) otherwise throw an error.
+ if (noProfileId) // && destination != null
+ return new Status(IStatus.ERROR, Activator.ID, Messages.Missing_profileid);
+
+ // make sure that we are set to be roaming before we update the values
if (!Boolean.valueOf(profile.getProperty(IProfile.PROP_ROAMING)).booleanValue())
return Status.OK_STATUS;
+
+ ProfileChangeRequest request = new ProfileChangeRequest(profile);
File destinationFile = destination.toFile();
if (!destinationFile.equals(new File(profile.getProperty(IProfile.PROP_INSTALL_FOLDER))))
request.setProfileProperty(IProfile.PROP_INSTALL_FOLDER, destination.toOSString());
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
index e7aba88ec..496ef12e9 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2009 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
@@ -25,6 +25,7 @@ public class Messages extends NLS {
public static String Missing_Engine;
public static String Missing_IU;
public static String Missing_planner;
+ public static String Missing_profileid;
public static String Ambigous_Command;
public static String Application_NoManager;
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
index 60bfddc9b..4c2f743e2 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2008 IBM Corporation and others.
+# Copyright (c) 2005, 2009 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
@@ -15,7 +15,7 @@ Operation_complete=Operation completed in {0} ms.
Operation_failed=Installation failed.
Cant_change_roaming=Problem while updading the profile {0}.
-
+Missing_profileid = Must specify a profile id if a destination is specified.
Missing_director=Director could not be loaded.
Missing_Engine=Engine could not be loaded.
Missing_bundle=The ''{0}'' bundle is missing.

Back to the top