/** * Loop over the known metadata repositories looking for the given IU within a particular range * @param publisherResult * @param iuId the id of the IU to look for * @param versionRange the version range to consider * @return The the IUs with the matching ids in the given range */ protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) { IQuery<IInstallableUnit> query = null; IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector(); query = QueryUtil.createIUQuery(iuId, versionRange); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) queryResult = publisherResult.query(query, progress); if (queryResult.isEmpty() && info.getMetadataRepository() != null) queryResult = info.getMetadataRepository().query(query, progress); if (queryResult.isEmpty() && info.getContextMetadataRepository() != null) queryResult = info.getContextMetadataRepository().query(query, progress); return queryResult; }
/** * Loop over the known metadata repositories looking for the given IU within a particular range * @param publisherResult * @param iuId the id of the IU to look for * @param versionRange the version range to consider * @return The the IUs with the matching ids in the given range */ protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) { IQuery<IInstallableUnit> query = null; IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector(); query = QueryUtil.createIUQuery(iuId, versionRange); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) queryResult = publisherResult.query(query, progress); if (queryResult.isEmpty() && info.getMetadataRepository() != null) queryResult = info.getMetadataRepository().query(query, progress); if (queryResult.isEmpty() && info.getContextMetadataRepository() != null) queryResult = info.getContextMetadataRepository().query(query, progress); return queryResult; }
/** * Loop over the known metadata repositories looking for the given IU within a particular range * @param publisherResult * @param iuId the id of the IU to look for * @param versionRange the version range to consider * @return The the IUs with the matching ids in the given range */ protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) { IQuery<IInstallableUnit> query = null; IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector(); query = QueryUtil.createIUQuery(iuId, versionRange); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) queryResult = publisherResult.query(query, progress); if (queryResult.isEmpty() && info.getMetadataRepository() != null) queryResult = info.getMetadataRepository().query(query, progress); if (queryResult.isEmpty() && info.getContextMetadataRepository() != null) queryResult = info.getContextMetadataRepository().query(query, progress); return queryResult; }
/** * Loop over the known metadata repositories looking for the given IU within a particular range * @param publisherResult * @param iuId the id of the IU to look for * @param versionRange the version range to consider * @return The the IUs with the matching ids in the given range */ protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) { IQuery<IInstallableUnit> query = null; IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector(); query = QueryUtil.createIUQuery(iuId, versionRange); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) queryResult = publisherResult.query(query, progress); if (queryResult.isEmpty() && info.getMetadataRepository() != null) queryResult = info.getMetadataRepository().query(query, progress); if (queryResult.isEmpty() && info.getContextMetadataRepository() != null) queryResult = info.getContextMetadataRepository().query(query, progress); return queryResult; }
/** * Loop over the known metadata repositories looking for the given IU. * Return the first IU found. * @param iuId the id of the IU to look for * @return the first matching IU or <code>null</code> if none. */ protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) { IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(iuId, version); if (version == null || Version.emptyVersion.equals(version)) query = QueryUtil.createLatestQuery(query); IQueryResult<IInstallableUnit> collector = Collector.emptyCollector(); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) collector = publisherResult.query(query, progress); if (collector.isEmpty() && info.getMetadataRepository() != null) collector = info.getMetadataRepository().query(query, progress); if (collector.isEmpty() && info.getContextMetadataRepository() != null) collector = info.getContextMetadataRepository().query(query, progress); if (!collector.isEmpty()) return collector.iterator().next(); return null; }
/** * Loop over the known metadata repositories looking for the given IU. * Return the first IU found. * @param iuId the id of the IU to look for * @return the first matching IU or <code>null</code> if none. */ protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) { IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(iuId, version); if (version == null || Version.emptyVersion.equals(version)) query = QueryUtil.createLatestQuery(query); IQueryResult<IInstallableUnit> collector = Collector.emptyCollector(); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) collector = publisherResult.query(query, progress); if (collector.isEmpty() && info.getMetadataRepository() != null) collector = info.getMetadataRepository().query(query, progress); if (collector.isEmpty() && info.getContextMetadataRepository() != null) collector = info.getContextMetadataRepository().query(query, progress); if (!collector.isEmpty()) return collector.iterator().next(); return null; }
/** * Loop over the known metadata repositories looking for the given IU. * Return the first IU found. * @param iuId the id of the IU to look for * @return the first matching IU or <code>null</code> if none. */ protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) { IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(iuId, version); if (version == null || Version.emptyVersion.equals(version)) query = QueryUtil.createLatestQuery(query); IQueryResult<IInstallableUnit> collector = Collector.emptyCollector(); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) collector = publisherResult.query(query, progress); if (collector.isEmpty() && info.getMetadataRepository() != null) collector = info.getMetadataRepository().query(query, progress); if (collector.isEmpty() && info.getContextMetadataRepository() != null) collector = info.getContextMetadataRepository().query(query, progress); if (!collector.isEmpty()) return collector.iterator().next(); return null; }
/** * Loop over the known metadata repositories looking for the given IU. * Return the first IU found. * @param iuId the id of the IU to look for * @return the first matching IU or <code>null</code> if none. */ protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) { IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(iuId, version); if (version == null || Version.emptyVersion.equals(version)) query = QueryUtil.createLatestQuery(query); IQueryResult<IInstallableUnit> collector = Collector.emptyCollector(); NullProgressMonitor progress = new NullProgressMonitor(); if (publisherResult != null) collector = publisherResult.query(query, progress); if (collector.isEmpty() && info.getMetadataRepository() != null) collector = info.getMetadataRepository().query(query, progress); if (collector.isEmpty() && info.getContextMetadataRepository() != null) collector = info.getContextMetadataRepository().query(query, progress); if (!collector.isEmpty()) return collector.iterator().next(); return null; }
/** * Create and register advice that will tell people what versions of the launcher bundle and * fragments are in use in this particular result. */ private void createLauncherAdvice(IPublisherInfo publisherInfo, IPublisherResult results) { Collection<IInstallableUnit> ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER); if (publisherInfo.getContextMetadataRepository() != null) ius.addAll(getIUs(publisherInfo.getContextMetadataRepository().query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet(), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER)); VersionAdvice advice = new VersionAdvice(); boolean found = false; for (IInstallableUnit iu : ius) { // skip over source bundles and fragments // TODO should we use the source property here rather than magic name matching? if (iu.getId().endsWith(".source") || QueryUtil.isFragment(iu)) //$NON-NLS-1$ continue; advice.setVersion(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), iu.getVersion()); found = true; } if (found) publisherInfo.addAdvice(advice); }
/** * Create and register advice that will tell people what versions of the launcher bundle and * fragments are in use in this particular result. */ private void createLauncherAdvice(IPublisherInfo publisherInfo, IPublisherResult results) { Collection<IInstallableUnit> ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER); if (publisherInfo.getContextMetadataRepository() != null) ius.addAll(getIUs(publisherInfo.getContextMetadataRepository().query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet(), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER)); VersionAdvice advice = new VersionAdvice(); boolean found = false; for (IInstallableUnit iu : ius) { // skip over source bundles and fragments // TODO should we use the source property here rather than magic name matching? if (iu.getId().endsWith(".source") || QueryUtil.isFragment(iu)) //$NON-NLS-1$ continue; advice.setVersion(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), iu.getVersion()); found = true; } if (found) publisherInfo.addAdvice(advice); }
if (queryResult.isEmpty()) queryResult = publisherInfo.getMetadataRepository().query(query, null); if (queryResult.isEmpty() && publisherInfo.getContextMetadataRepository() != null) queryResult = publisherInfo.getContextMetadataRepository().query(query, null);
private Collection<IInstallableUnit> getIUs(SiteIU siteIU, IPublisherInfo publisherInfo, IPublisherResult results) { String id = siteIU.getID(); String range = siteIU.getRange(); String type = siteIU.getQueryType(); String expression = siteIU.getQueryExpression(); Object[] params = siteIU.getQueryParams(); if (id == null && (type == null || expression == null)) return CollectionUtils.emptyList(); IQuery<IInstallableUnit> query = null; if (id != null) { VersionRange vRange = new VersionRange(range); query = QueryUtil.createIUQuery(id, vRange); } else if (type.equals("context")) { //$NON-NLS-1$ query = QueryUtil.createQuery(expression, params); } else if (type.equals("match")) //$NON-NLS-1$ query = QueryUtil.createMatchQuery(expression, params); if (query == null) return CollectionUtils.emptyList(); IQueryResult<IInstallableUnit> queryResult = results.query(query, null); if (queryResult.isEmpty()) queryResult = publisherInfo.getMetadataRepository().query(query, null); if (queryResult.isEmpty() && publisherInfo.getContextMetadataRepository() != null) queryResult = publisherInfo.getContextMetadataRepository().query(query, null); return queryResult.toUnmodifiableSet(); }
if (queryResult.isEmpty()) queryResult = publisherInfo.getMetadataRepository().query(query, null); if (queryResult.isEmpty() && publisherInfo.getContextMetadataRepository() != null) queryResult = publisherInfo.getContextMetadataRepository().query(query, null);