| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008, 2010 IBM Corporation and others. |
| 3 |
* |
| 4 |
* This program and the accompanying materials |
| 5 |
* are made available under the terms of the Eclipse Public License 2.0 |
| 6 |
* which accompanies this distribution, and is available at |
| 7 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: EPL-2.0 |
| 10 |
* |
| 11 |
* Contributors: |
| 12 |
* IBM Corporation - initial API and implementation |
| 13 |
* Sonatype Inc - Refactoring |
| 14 |
*******************************************************************************/ |
| 15 |
package org.eclipse.equinox.p2.planner; |
| 16 |
|
| 17 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
| 18 |
|
| 19 |
/** |
| 20 |
* Helper method to decide on the way the installable units are being included. |
| 21 |
* @noinstantiate This class is not intended to be instantiated by clients. |
| 22 |
* @noextend This class is not intended to be subclassed by clients. |
| 23 |
* @since 2.0 |
| 24 |
*/ |
| 25 |
public class ProfileInclusionRules { |
| 26 |
private ProfileInclusionRules() { |
| 27 |
//Can't instantiate profile inclusion rules |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Returns an inclusion rule to strictly install the given installable unit. Strictly |
| 32 |
* installed installable units will never be uninstalled in order to satisfy a |
| 33 |
* later profile change request. That is, when there is a dependency conflict |
| 34 |
* between a strictly installed unit and a non-strict unit, the strictly installed |
| 35 |
* installable unit will take precedence. |
| 36 |
* |
| 37 |
* @param iu the installable unit to be installed. |
| 38 |
* @return an opaque token to be passed to the {@link IProfileChangeRequest#setInstallableUnitInclusionRules(IInstallableUnit, String)} |
| 39 |
*/ |
| 40 |
public static String createStrictInclusionRule(IInstallableUnit iu) { |
| 41 |
return "STRICT"; //$NON-NLS-1$ |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns an inclusion rule to optionally install the given installable unit. An optionally |
| 46 |
* installed installable unit will automatically be removed from the profile if any of |
| 47 |
* its dependencies become unsatisfied. |
| 48 |
* |
| 49 |
* @param iu the installable unit to be installed. |
| 50 |
* @return an opaque token to be passed to the {@link IProfileChangeRequest#setInstallableUnitInclusionRules(IInstallableUnit, String)} |
| 51 |
*/ |
| 52 |
public static String createOptionalInclusionRule(IInstallableUnit iu) { |
| 53 |
return "OPTIONAL"; //$NON-NLS-1$ |
| 54 |
} |
| 55 |
} |