use of org.eclipse.epp.internal.mpc.core.model.Node in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method installErrorReport.
public void installErrorReport(IProgressMonitor monitor, IStatus result, Set<CatalogItem> items, IInstallableUnit[] operationIUs, String resolutionDetails) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, Messages.MarketplaceDiscoveryStrategy_sendingErrorNotification, 100);
try {
Set<Node> nodes = new HashSet<Node>();
for (CatalogItem item : items) {
Object data = item.getData();
if (data instanceof INode) {
nodes.add((Node) data);
}
}
Set<String> iuIdsAndVersions = new HashSet<String>();
for (IInstallableUnit iu : operationIUs) {
String id = iu.getId();
String version = iu.getVersion() == null ? null : iu.getVersion().toString();
// $NON-NLS-1$
iuIdsAndVersions.add(id + "," + version);
}
marketplaceService.reportInstallError(result, nodes, iuIdsAndVersions, resolutionDetails, progress);
} finally {
progress.done();
}
}
use of org.eclipse.epp.internal.mpc.core.model.Node in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method performNodeQuery.
private ISearchResult performNodeQuery(String nodeUrl, IProgressMonitor progress) throws CoreException {
final INode[] queryNode = new INode[1];
MarketplaceUrlHandler urlHandler = new MarketplaceUrlHandler() {
@Override
protected boolean handleNode(CatalogDescriptor descriptor, String url, INode node) {
queryNode[0] = node;
return true;
}
};
if (urlHandler.handleUri(nodeUrl) && queryNode[0] != null) {
INode node = marketplaceService.getNode(queryNode[0], progress);
SearchResult result = new SearchResult();
result.setMatchCount(1);
result.setNodes(Collections.singletonList((Node) node));
return result;
}
return null;
}
use of org.eclipse.epp.internal.mpc.core.model.Node in project epp.mpc by eclipse.
the class MarketplaceInfo method computeInstalledNodes.
/**
* Calculate the known catalog nodes that might be installed. Since no remote query should happen, this only checks
* if any one of the IUs for a node are installed.
*
* @param repositoryUrl
* the catalog url for which installed nodes should be computed
* @param installedIus
* all of the currently installed IUs
* @return a set of node ids, or an empty set if there are no known installed nodes
* @deprecated use {@link #computeInstalledNodes(URL, Map)} instead
*/
@Deprecated
public synchronized Set<INode> computeInstalledNodes(URL repositoryUrl, Set<String> installedIus) {
Set<INode> nodes = new HashSet<INode>();
String keyPrefix = computeUrlKey(repositoryUrl) + '#';
for (Map.Entry<String, List<String>> entry : nodeKeyToIU.entrySet()) {
if (entry.getKey().startsWith(keyPrefix)) {
List<String> ius = nodeKeyToIU.get(entry.getKey());
if (computeInstalled(installedIus, ius, false)) {
String nodeId = entry.getKey().substring(keyPrefix.length());
Node node = new Node();
node.setId(nodeId);
nodes.add(node);
}
}
}
return nodes;
}
use of org.eclipse.epp.internal.mpc.core.model.Node in project epp.mpc by eclipse.
the class MarketplaceInfoTest method createTestItem.
public static MarketplaceNodeCatalogItem createTestItem() throws Exception {
MarketplaceNodeCatalogItem item = new MarketplaceNodeCatalogItem();
item.setMarketplaceUrl(new URL("http://marketplace.eclipse.org"));
item.setId("123");
Node node = new Node();
node.setId(item.getId());
node.setUrl("http://marketplace.eclipse.org/node/" + node.getId());
node.setIus(new Ius());
addIu(node, "com.example.test.a1");
addIu(node, "com.example.test.a2");
item.setData(node);
item.setInstallableUnits(node.getIus().getIu());
return item;
}
use of org.eclipse.epp.internal.mpc.core.model.Node in project epp.mpc by eclipse.
the class MarketplaceCatalogTest method setupNodes.
protected void setupNodes() {
Node node = new Node();
node.setName("Not installed");
node.setId("1001");
node.setIus(new Ius());
node.getIus().getIuElements().add(new Iu("org.example.notinstalled.iu"));
discoveryNodes.add(node);
node = new Node();
node.setName("Up to date");
node.setId("1002");
node.setIus(new Ius());
node.getIus().getIuElements().add(new Iu("org.example.installed.iu"));
discoveryNodes.add(node);
installedNodes.add(node);
node = new Node();
node.setName("Update available");
node.setId("1003");
node.setIus(new Ius());
node.getIus().getIuElements().add(new Iu("org.example.updateable.iu"));
discoveryNodes.add(node);
installedNodes.add(node);
updateAvailable.add(node);
}
Aggregations