1 /*******************************************************************************
2 * Copyright (c) 2007, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.equinox.internal.provisional.p2.installer;
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.OperationCanceledException;
18 * The install advisor helps to make decisions during install, and is the conduit
19 * for reporting progress and results back to an end user or log.
21 public abstract class InstallAdvisor {
23 * Performs the actual install. The advisor is responsible for handling progress
24 * monitoring and cancelation. The advisor may perform the install in
25 * another thread, but must block the calling thread until the install
28 * @param operation The install operation to run
29 * @return IStatus The result of the install operation. This is typically
30 * just the return value of {@link IInstallOperation#install(IProgressMonitor)},
31 * but the advisor may alter the result status if desired.
33 public abstract IStatus performInstall(IInstallOperation operation);
36 * Allows the advisor to modify or fill in missing values in the install description.
37 * @param description The initial install description
38 * @return The install description to be used for the install.
39 * @exception OperationCanceledException if the install should be canceled.
41 public abstract InstallDescription prepareInstallDescription(InstallDescription description);
44 * Prompts for whether the installed application should be launched immediately.
45 * This method is only called after a successful install.
47 * @param description The initial install description
48 * @return <code>true</code> if the product should be launched, and
49 * <code>false</code> otherwise.
51 public abstract boolean promptForLaunch(InstallDescription description);
54 * Reports some result information to the context. The status may be
55 * information, warning, or an error.
57 public abstract void setResult(IStatus status);
60 * Initializes the install advisor. This method must be called before calling any
61 * other methods on the advisor are called. Subsequent invocations of this
64 public abstract void start();
67 * Stops the install advisor. The advisor becomes invalid after it has been
68 * stopped; a stopped advisor cannot be restarted.
70 public abstract void stop();