| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2010 Cloudsmith Inc. 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 |
* Cloudsmith Inc. - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.p2.metadata.index; |
| 15 |
|
| 16 |
import java.util.Iterator; |
| 17 |
|
| 18 |
/** |
| 19 |
* An index provider is typically an IQueryable. |
| 20 |
* @since 2.0 |
| 21 |
*/ |
| 22 |
public interface IIndexProvider<T> { |
| 23 |
/** |
| 24 |
* Return an index optimized for producing candidates based on values |
| 25 |
* for a <code>memberName</code> that denotes a member of the index |
| 26 |
* type. |
| 27 |
* @param memberName A member of type <code>T</code>. |
| 28 |
* @return An index or <code>null</code> if this provider does not support |
| 29 |
* this index. |
| 30 |
*/ |
| 31 |
IIndex<T> getIndex(String memberName); |
| 32 |
|
| 33 |
/** |
| 34 |
* Return the iterator that delivers all rows that the target query should |
| 35 |
* consider. This is used when no index can be found for any possible |
| 36 |
* member. |
| 37 |
* @return An iterator. Possibly empty but never <code>null</code>. |
| 38 |
*/ |
| 39 |
Iterator<T> everything(); |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns a property that this index manages on behalf of a <code>client</code> object. |
| 43 |
* Examples of this is the properties that a profile manages for installable |
| 44 |
* units. |
| 45 |
* @param client The client for which the property is managed. Typically an IU. |
| 46 |
* @param memberName The name of the managed properties, i.e. "profileProperties" |
| 47 |
* @param key The property key |
| 48 |
* @return The managed property value or <code>null</code> if no value could be found. |
| 49 |
*/ |
| 50 |
Object getManagedProperty(Object client, String memberName, Object key); |
| 51 |
} |