| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009, 2010 Tasktop Technologies 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 |
* Tasktop Technologies - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.internal.p2.discovery; |
| 15 |
|
| 16 |
import java.util.List; |
| 17 |
import org.eclipse.core.runtime.CoreException; |
| 18 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 19 |
import org.eclipse.equinox.internal.p2.discovery.model.*; |
| 20 |
|
| 21 |
/** |
| 22 |
* An abstraction of a strategy for discovering connectors and categories. Strategy design pattern. Note that strategies |
| 23 |
* are not reusable and must be disposed. |
| 24 |
* |
| 25 |
* @author David Green |
| 26 |
* @author Steffen Pingel |
| 27 |
*/ |
| 28 |
public abstract class AbstractDiscoveryStrategy { |
| 29 |
|
| 30 |
protected List<CatalogCategory> categories; |
| 31 |
|
| 32 |
protected List<Certification> certifications; |
| 33 |
|
| 34 |
protected List<CatalogItem> items; |
| 35 |
|
| 36 |
protected List<Tag> tags; |
| 37 |
|
| 38 |
public void dispose() { |
| 39 |
// ignore |
| 40 |
} |
| 41 |
|
| 42 |
public List<CatalogCategory> getCategories() { |
| 43 |
return categories; |
| 44 |
} |
| 45 |
|
| 46 |
public List<Certification> getCertifications() { |
| 47 |
return certifications; |
| 48 |
} |
| 49 |
|
| 50 |
public List<CatalogItem> getItems() { |
| 51 |
return items; |
| 52 |
} |
| 53 |
|
| 54 |
public List<Tag> getTags() { |
| 55 |
return tags; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Perform discovery and add discovered items to {@link #getCategories() categories} and {@link #getItems()}. |
| 60 |
*/ |
| 61 |
public abstract void performDiscovery(IProgressMonitor monitor) throws CoreException; |
| 62 |
|
| 63 |
public void setCategories(List<CatalogCategory> categories) { |
| 64 |
this.categories = categories; |
| 65 |
} |
| 66 |
|
| 67 |
public void setCertifications(List<Certification> certifications) { |
| 68 |
this.certifications = certifications; |
| 69 |
} |
| 70 |
|
| 71 |
public void setItems(List<CatalogItem> connectors) { |
| 72 |
this.items = connectors; |
| 73 |
} |
| 74 |
|
| 75 |
public void setTags(List<Tag> itemKinds) { |
| 76 |
this.tags = itemKinds; |
| 77 |
} |
| 78 |
|
| 79 |
} |