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