Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-01-28 19:10:49 +0000
committerJohn Arthorne2008-01-28 19:10:49 +0000
commit326b85c0fe3fe624282453becdfb75ba59bab650 (patch)
tree4a062a07d7165e3ee90a139ced8d424b87dece65
parent5457c2716f1b126ab41d946118f98a5bed37d300 (diff)
downloadrt.equinox.p2-326b85c0fe3fe624282453becdfb75ba59bab650.tar.gz
rt.equinox.p2-326b85c0fe3fe624282453becdfb75ba59bab650.tar.xz
rt.equinox.p2-326b85c0fe3fe624282453becdfb75ba59bab650.zip
start p2 before running install operation
-rw-r--r--bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java22
2 files changed, 33 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
index 609735ea1..972d80bda 100644
--- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
+++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
@@ -21,7 +21,10 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.installer.ui.SWTInstallAdvisor;
import org.eclipse.equinox.internal.provisional.p2.installer.InstallAdvisor;
import org.eclipse.equinox.internal.provisional.p2.installer.InstallDescription;
+import org.eclipse.equinox.p2.engine.Profile;
import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
/**
* This is a simple installer application built using P2. The application must be given
@@ -134,7 +137,7 @@ public class InstallApplication implements IApplication {
InstallDescription description = null;
try {
description = computeInstallDescription();
-
+ startRequiredBundles(description);
//perform long running install operation
InstallUpdateProductOperation operation = new InstallUpdateProductOperation(InstallerActivator.getDefault().getContext(), description);
IStatus result = advisor.performInstall(operation);
@@ -166,6 +169,33 @@ public class InstallApplication implements IApplication {
}
}
+ /**
+ * Starts the p2 bundles needed to continue with the install.
+ */
+ private void startRequiredBundles(InstallDescription description) throws CoreException {
+ IPath installLocation = description.getInstallLocation();
+ if (installLocation == null)
+ throw fail("Install failed because the install location was not set", null);
+ //set agent location if specified
+ IPath agentLocation = description.getAgentLocation();
+ if (agentLocation != null) {
+ String agentArea = System.getProperty("eclipse.p2.data.area"); //$NON-NLS-1$
+ if (agentArea == null || agentArea.length() == 0)
+ System.setProperty("eclipse.p2.data.area", agentLocation.toOSString()); //$NON-NLS-1$
+ }
+ //set bundle pool location if specified
+ IPath bundleLocation = description.getBundleLocation();
+ if (bundleLocation != null && System.getProperty(Profile.PROP_CACHE) == null)
+ System.setProperty(Profile.PROP_CACHE, bundleLocation.toString());
+
+ //start up p2
+ try {
+ InstallerActivator.getDefault().getBundle("org.eclipse.equinox.p2.exemplarysetup").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
+ } catch (BundleException e) {
+ throw fail("Unable to start provisioning infrastructure", e);
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#stop()
*/
diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
index 7c4c47c7c..3a3e36e23 100644
--- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
+++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
@@ -115,14 +115,14 @@ public class InstallUpdateProductOperation implements IInstallOperation {
}
/**
- * Throws an exception of severity error with the given error message.
+ * Returns an exception of severity error with the given error message.
*/
private CoreException fail(String message) {
return fail(message, null);
}
/**
- * Throws an exception of severity error with the given error message.
+ * Returns an exception of severity error with the given error message.
*/
private CoreException fail(String message, Throwable throwable) {
return new CoreException(new Status(IStatus.ERROR, InstallerActivator.PI_INSTALLER, message, throwable));
@@ -219,24 +219,6 @@ public class InstallUpdateProductOperation implements IInstallOperation {
}
private void preInstall() throws CoreException {
- IPath installLocation = installDescription.getInstallLocation();
- if (installLocation == null)
- throw fail("Install failed because the install location was not set");
- //set agent location if specified
- IPath agentLocation = installDescription.getAgentLocation();
- if (agentLocation != null && System.getProperty("eclipse.p2.data.area") == null) //$NON-NLS-1$
- System.setProperty("eclipse.p2.data.area", agentLocation.toOSString()); //$NON-NLS-1$
- //set bundle pool location if specified
- IPath bundleLocation = installDescription.getBundleLocation();
- if (bundleLocation != null && System.getProperty(Profile.PROP_CACHE) == null)
- System.setProperty(Profile.PROP_CACHE, bundleLocation.toString());
-
- //start up p2
- try {
- InstallerActivator.getDefault().getBundle("org.eclipse.equinox.p2.exemplarysetup").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
- } catch (BundleException e) {
- throw fail("Unable to start p2", e);
- }
//obtain required services
serviceReferences.clear();
director = (IDirector) getService(IDirector.class.getName());

Back to the top