Skip to main content
summaryrefslogtreecommitdiffstats
blob: 286ea81b3f6277db8b4d0526cea83c91b5b721a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*******************************************************************************
 * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This
 * program and the accompanying materials are made available under the terms of
 * the Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Code 9 - initial API and implementation
 *   IBM - ongoing development
 ******************************************************************************/
package org.eclipse.equinox.p2.publisher;

import java.util.Collection;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.query.IQueryable;

/**
 * Publisher results represent the result of running a publishing operation.  A result is a 
 * collection of IInstallableUnits that were created or read duing the operation.  The result
 * IUs are categorized either as "roots" or "non-roots".  The meaning of these types is 
 * determined by the actions involved in the operation and it is up to the consumer of the
 * result to interpret the collections.
 */
public interface IPublisherResult extends IQueryable<IInstallableUnit> {
	/**
	 * Merge mode setting that causes all root results to be merged into 
	 * the root of the merged results and all non-roots to become non-roots.
	 */
	public static final int MERGE_MATCHING = 0;

	/** 
	 * Merge mode setting that causes all root and non-root result entries to 
	 * be placed in the root collection of the result.
	 */
	public static final int MERGE_ALL_ROOT = 1;

	/** 
	 * Merge mode setting that causes all root and non-root result entries to 
	 * be placed in the non-root collection of the result.
	 */
	public static final int MERGE_ALL_NON_ROOT = 2;

	/**
	 * An opaque token used to identify the root elements of a result.
	 */
	public static final String ROOT = "root"; //$NON-NLS-1$

	/**
	 * An opaque token used to identify the non-root elements of a result.
	 */
	public static final String NON_ROOT = "non_root"; //$NON-NLS-1$

	/**
	 * Add the given IU to this result and identify it as the given type
	 * @see #ROOT
	 * @see #NON_ROOT
	 * 
	 * @param iu the IU to add
	 * @param type the type of the IU in this result
	 */
	public void addIU(IInstallableUnit iu, String type);

	/**
	 * Add all of the given IUs to this result and identify it as the given type
	 * @see #ROOT
	 * @see #NON_ROOT
	 * 
	 * @param ius the IUs to add
	 * @param type the type of the IUs in this result
	 */
	public void addIUs(Collection<IInstallableUnit> ius, String type);

	/**
	 * Returns the IUs of the given type with the given id in this result.
	 * @param id the id of the IUs to look for
	 * @param type the type of IUs to look for in this result
	 * @return the requested IUs
	 * @see #ROOT
	 * @see #NON_ROOT
	 */
	public Collection<IInstallableUnit> getIUs(String id, String type);

	/**
	 * Returns the first available IU of the given type with the given id in this result.
	 * @param id the id of the IU to look for
	 * @param type the type of IU to look for in this result
	 * @return the requested IU
	 * @see #ROOT
	 * @see #NON_ROOT
	 * @deprecated This method should be removed as it essentially returns a random IU
	 * with the given ID.  There are some uses for this but not many and they can use #getIUs
	 */
	@Deprecated
	public IInstallableUnit getIU(String id, String type);

	/**
	 * Returns the IU of the given type with the given id and version in this result.
	 * @param id the id of the IU to look for
	 * @param version the version of the IU to look for
	 * @param type the type of IU to look for in this result
	 * @return the requested IU
	 * @see #ROOT
	 * @see #NON_ROOT
	 */
	public IInstallableUnit getIU(String id, Version version, String type);

	/**
	 * Merges the given result in this result according to the given mode. 
	 * @see #MERGE_ALL_NON_ROOT
	 * @see #MERGE_ALL_ROOT
	 * @see #MERGE_MATCHING
	 * @param result the result to merge into this result
	 * @param mode the merge mode to use
	 */
	public void merge(IPublisherResult result, int mode);
}

Back to the top