use of org.eclipse.equinox.p2.operations.RepositoryTracker in project knime-core by knime.
the class NewReleaseMessageInjector method checkNewMinorVersion.
private List<UpdateInfo> checkNewMinorVersion() throws IOException, URISyntaxException {
final ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
RepositoryTracker tracker = provUI.getRepositoryTracker();
if (tracker == null) {
// if run from the IDE there will be no tracker
return Collections.emptyList();
}
List<UpdateInfo> updateList = new ArrayList<>();
for (URI uri : tracker.getKnownRepositories(provUI.getSession())) {
if (("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) && (uri.getHost().endsWith(".knime.org") || uri.getHost().endsWith(".knime.com"))) {
UpdateInfo newRelease = UpdateChecker.checkForNewRelease(uri);
if (newRelease != null) {
updateList.add(newRelease);
}
}
}
return updateList;
}
use of org.eclipse.equinox.p2.operations.RepositoryTracker in project yamcs-studio by yamcs.
the class UpdateHandler method preloadRepositories.
@Override
protected boolean preloadRepositories() {
hasNoRepos = false;
RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
hasNoRepos = true;
return false;
}
return super.preloadRepositories();
}
use of org.eclipse.equinox.p2.operations.RepositoryTracker in project epp.mpc by eclipse.
the class AbstractProvisioningOperation method addRepositories.
protected List<IMetadataRepository> addRepositories(SubMonitor monitor) throws URISyntaxException, ProvisionException {
// tell p2 that it's okay to use these repositories
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
RepositoryTracker repositoryTracker = ProvisioningUI.getDefaultUI().getRepositoryTracker();
repositoryLocations = new HashSet<URI>();
if (addedRepositoryLocations == null) {
addedRepositoryLocations = new HashSet<URI>();
}
Set<URI> knownRepositories = new HashSet<URI>(Arrays.asList(repositoryTracker.getKnownRepositories(session)));
monitor.setWorkRemaining(items.size() * 5);
for (CatalogItem descriptor : items) {
String siteUrl = descriptor.getSiteUrl();
if (siteUrl != null) {
URI uri = URLUtil.toURI(siteUrl);
if (repositoryLocations.add(uri) && !knownRepositories.contains(uri)) {
checkCancelled(monitor);
repositoryTracker.addRepository(uri, null, session);
addedRepositoryLocations.add(uri);
}
}
monitor.worked(1);
}
// fetch meta-data for these repositories
ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>();
monitor.setWorkRemaining(repositories.size());
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : repositoryLocations) {
checkCancelled(monitor);
IMetadataRepository repository = manager.loadRepository(uri, monitor.newChild(1));
repositories.add(repository);
}
return repositories;
}
use of org.eclipse.equinox.p2.operations.RepositoryTracker in project epp.mpc by eclipse.
the class AbstractProvisioningOperation method removeRepositoryLocations.
/**
* remove the given repository locations from the repository tracker.
*
* @param repositoryLocations
*/
public static void removeRepositoryLocations(Set<URI> repositoryLocations) {
if (repositoryLocations == null || repositoryLocations.isEmpty()) {
return;
}
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
RepositoryTracker repositoryTracker = ProvisioningUI.getDefaultUI().getRepositoryTracker();
repositoryTracker.removeRepositories(repositoryLocations.toArray(new URI[repositoryLocations.size()]), session);
}
use of org.eclipse.equinox.p2.operations.RepositoryTracker in project liferay-ide by liferay.
the class LiferayUIPlugin method _addRepository.
private void _addRepository() throws URISyntaxException {
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
ProvisioningSession provisioningSession = provisioningUI.getSession();
RepositoryTracker repositoryTracker = provisioningUI.getRepositoryTracker();
URI[] knownRepositories = repositoryTracker.getKnownRepositories(provisioningSession);
URI liferayUri = new URI("https://releases.liferay.com/tools/ide/latest/stable/");
boolean containLifreayUri = Stream.of(knownRepositories).anyMatch(uri -> Objects.equals(uri, liferayUri));
if (!containLifreayUri) {
repositoryTracker.addRepository(liferayUri, "Liferay IDE Stable releases", provisioningSession);
}
}
Aggregations