| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008, 2010 Code 9 and others. |
| 3 |
* |
| 4 |
* This |
| 5 |
* program and the accompanying materials are made available under the terms of |
| 6 |
* the Eclipse Public License 2.0 which accompanies this distribution, and is |
| 7 |
* available at |
| 8 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 9 |
* |
| 10 |
* SPDX-License-Identifier: EPL-2.0 |
| 11 |
* |
| 12 |
* Contributors: |
| 13 |
* Code 9 - initial API and implementation |
| 14 |
* IBM - ongoing development |
| 15 |
******************************************************************************/ |
| 16 |
package org.eclipse.equinox.p2.publisher; |
| 17 |
|
| 18 |
import java.util.Collection; |
| 19 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
| 20 |
import org.eclipse.equinox.p2.metadata.Version; |
| 21 |
import org.eclipse.equinox.p2.query.IQueryable; |
| 22 |
|
| 23 |
/** |
| 24 |
* Publisher results represent the result of running a publishing operation. A result is a |
| 25 |
* collection of IInstallableUnits that were created or read duing the operation. The result |
| 26 |
* IUs are categorized either as "roots" or "non-roots". The meaning of these types is |
| 27 |
* determined by the actions involved in the operation and it is up to the consumer of the |
| 28 |
* result to interpret the collections. |
| 29 |
*/ |
| 30 |
public interface IPublisherResult extends IQueryable<IInstallableUnit> { |
| 31 |
/** |
| 32 |
* Merge mode setting that causes all root results to be merged into |
| 33 |
* the root of the merged results and all non-roots to become non-roots. |
| 34 |
*/ |
| 35 |
public static final int MERGE_MATCHING = 0; |
| 36 |
|
| 37 |
/** |
| 38 |
* Merge mode setting that causes all root and non-root result entries to |
| 39 |
* be placed in the root collection of the result. |
| 40 |
*/ |
| 41 |
public static final int MERGE_ALL_ROOT = 1; |
| 42 |
|
| 43 |
/** |
| 44 |
* Merge mode setting that causes all root and non-root result entries to |
| 45 |
* be placed in the non-root collection of the result. |
| 46 |
*/ |
| 47 |
public static final int MERGE_ALL_NON_ROOT = 2; |
| 48 |
|
| 49 |
/** |
| 50 |
* An opaque token used to identify the root elements of a result. |
| 51 |
*/ |
| 52 |
public static final String ROOT = "root"; //$NON-NLS-1$ |
| 53 |
|
| 54 |
/** |
| 55 |
* An opaque token used to identify the non-root elements of a result. |
| 56 |
*/ |
| 57 |
public static final String NON_ROOT = "non_root"; //$NON-NLS-1$ |
| 58 |
|
| 59 |
/** |
| 60 |
* Add the given IU to this result and identify it as the given type |
| 61 |
* @see #ROOT |
| 62 |
* @see #NON_ROOT |
| 63 |
* |
| 64 |
* @param iu the IU to add |
| 65 |
* @param type the type of the IU in this result |
| 66 |
*/ |
| 67 |
public void addIU(IInstallableUnit iu, String type); |
| 68 |
|
| 69 |
/** |
| 70 |
* Add all of the given IUs to this result and identify it as the given type |
| 71 |
* @see #ROOT |
| 72 |
* @see #NON_ROOT |
| 73 |
* |
| 74 |
* @param ius the IUs to add |
| 75 |
* @param type the type of the IUs in this result |
| 76 |
*/ |
| 77 |
public void addIUs(Collection<IInstallableUnit> ius, String type); |
| 78 |
|
| 79 |
/** |
| 80 |
* Returns the IUs of the given type with the given id in this result. |
| 81 |
* @param id the id of the IUs to look for |
| 82 |
* @param type the type of IUs to look for in this result |
| 83 |
* @return the requested IUs |
| 84 |
* @see #ROOT |
| 85 |
* @see #NON_ROOT |
| 86 |
*/ |
| 87 |
public Collection<IInstallableUnit> getIUs(String id, String type); |
| 88 |
|
| 89 |
/** |
| 90 |
* Returns the first available IU of the given type with the given id in this result. |
| 91 |
* @param id the id of the IU to look for |
| 92 |
* @param type the type of IU to look for in this result |
| 93 |
* @return the requested IU |
| 94 |
* @see #ROOT |
| 95 |
* @see #NON_ROOT |
| 96 |
* @deprecated This method should be removed as it essentially returns a random IU |
| 97 |
* with the given ID. There are some uses for this but not many and they can use #getIUs |
| 98 |
*/ |
| 99 |
@Deprecated |
| 100 |
public IInstallableUnit getIU(String id, String type); |
| 101 |
|
| 102 |
/** |
| 103 |
* Returns the IU of the given type with the given id and version in this result. |
| 104 |
* @param id the id of the IU to look for |
| 105 |
* @param version the version of the IU to look for |
| 106 |
* @param type the type of IU to look for in this result |
| 107 |
* @return the requested IU |
| 108 |
* @see #ROOT |
| 109 |
* @see #NON_ROOT |
| 110 |
*/ |
| 111 |
public IInstallableUnit getIU(String id, Version version, String type); |
| 112 |
|
| 113 |
/** |
| 114 |
* Merges the given result in this result according to the given mode. |
| 115 |
* @see #MERGE_ALL_NON_ROOT |
| 116 |
* @see #MERGE_ALL_ROOT |
| 117 |
* @see #MERGE_MATCHING |
| 118 |
* @param result the result to merge into this result |
| 119 |
* @param mode the merge mode to use |
| 120 |
*/ |
| 121 |
public void merge(IPublisherResult result, int mode); |
| 122 |
} |