use of org.eclipse.epp.mpc.core.service.IMarketplaceService in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategyTest method testSearchByNodeUrl.
@Test
public void testSearchByNodeUrl() throws Exception {
final INode[] testNode = new INode[1];
final IMarketplaceService marketplaceService = new DefaultMarketplaceService(catalogUrl) {
@Override
public Node getNode(INode node, IProgressMonitor monitor) throws CoreException {
testNode[0] = node;
return (Node) node;
}
@Override
public SearchResult search(IMarket market, ICategory category, String queryText, IProgressMonitor monitor) throws CoreException {
Assert.fail("Unexpected invocation");
// dead code
return null;
}
};
setupCatalog(marketplaceService);
testNode[0] = null;
catalog.performQuery(null, null, new URL(catalogUrl, "content/test").toExternalForm(), new NullProgressMonitor());
assertNotNull(testNode[0]);
assertNotNull(testNode[0].getUrl());
testNode[0] = null;
catalog.performQuery(null, null, new URL(catalogUrl, "node/12345").toExternalForm(), new NullProgressMonitor());
assertNotNull(testNode[0]);
assertNotNull(testNode[0].getId());
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceService in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategyTest method setupCatalog.
private void setupCatalog(final IMarketplaceService marketplaceService) {
discoveryStrategy = new MarketplaceDiscoveryStrategy(catalogDescriptor) {
@Override
public IMarketplaceService createMarketplaceService() {
return marketplaceService;
}
};
catalog.getDiscoveryStrategies().clear();
catalog.getDiscoveryStrategies().add(discoveryStrategy);
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceService in project epp.mpc by eclipse.
the class UserFavoritesService method getMarketplaceBaseUri.
private String getMarketplaceBaseUri() {
String marketplaceBaseUri = getStorageService().getMarketplaceBaseUri();
if (marketplaceBaseUri != null) {
return marketplaceBaseUri;
}
IMarketplaceService defaultMarketplaceService = ServiceHelper.getMarketplaceServiceLocator().getDefaultMarketplaceService();
if (defaultMarketplaceService != null) {
return defaultMarketplaceService.getBaseUrl().toString();
}
return DefaultMarketplaceService.DEFAULT_SERVICE_LOCATION;
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceService in project epp.mpc by eclipse.
the class ProvisioningJobListener method done.
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
Job job = new Job(Messages.ProvisioningJobListener_notificationTaskName) {
{
setPriority(Job.LONG);
setSystem(true);
setUser(true);
}
@Override
protected IStatus run(final IProgressMonitor monitor) {
ConcurrentTaskManager taskManager = new ConcurrentTaskManager(installItems.size(), Messages.ProvisioningJobListener_notificationTaskName);
for (CatalogItem item : installItems) {
if (item instanceof MarketplaceNodeCatalogItem) {
final MarketplaceNodeCatalogItem nodeItem = (MarketplaceNodeCatalogItem) item;
taskManager.submit(new Runnable() {
public void run() {
INode node = nodeItem.getData();
URL marketplaceUrl = nodeItem.getMarketplaceUrl();
IMarketplaceService marketplaceService = ServiceHelper.getMarketplaceServiceLocator().getMarketplaceService(marketplaceUrl.toString());
marketplaceService.reportInstallSuccess(node, new NullProgressMonitor() {
@Override
public boolean isCanceled() {
return monitor.isCanceled();
}
});
}
});
}
}
try {
taskManager.waitUntilFinished(monitor);
} catch (CoreException e) {
return e.getStatus();
}
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
};
job.schedule();
}
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceService in project epp.mpc by eclipse.
the class DiscoverNatureSupportJob method run.
@Override
protected IStatus run(IProgressMonitor monitor) {
BundleContext bundleContext = MarketplaceClientUiPlugin.getBundleContext();
ServiceReference<IMarketplaceServiceLocator> locatorReference = bundleContext.getServiceReference(IMarketplaceServiceLocator.class);
IMarketplaceServiceLocator locator = bundleContext.getService(locatorReference);
IMarketplaceService marketplaceService = locator.getDefaultMarketplaceService();
// $NON-NLS-1$]
String fileExtensionTag = "nature_" + natureId;
try {
ISearchResult searchResult = marketplaceService.tagged(fileExtensionTag, monitor);
nodes = searchResult.getNodes();
} catch (CoreException ex) {
IStatus status = new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.LookupByNatureJob_discoveryFailed, natureId), ex);
MarketplaceClientUi.getLog().log(status);
// Do not return this status as it would show an error
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
Aggregations