@Override public Collection<IRequirement> getMandatoryRequires() { VersionRange strictUnitRange = new VersionRange(unitVersion, true, unitVersion, true); return Collections.singleton(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unitName, strictUnitRange, null, false, false)); }
private static VersionRange parseVersionRange(String versionRange) { if (versionRange == null) { return null; } try { return new VersionRange(versionRange); } catch (IllegalArgumentException e) { throw new TargetPlatformFilterSyntaxException("Failed to parse version range: " + versionRange, e); } }
@Override public void addDependency(String type, String id, String versionRange) throws IllegalArtifactReferenceException { final VersionRange parsedVersionRange; try { parsedVersionRange = new VersionRange(versionRange); } catch (IllegalArgumentException e) { throw new IllegalArtifactReferenceException( "The string \"" + versionRange + "\" is not a valid OSGi version range"); } additionalRequirements.add(ArtifactTypeHelper.createRequirementFor(type, id, parsedVersionRange)); }
static VersionRange computeUpdateRange(org.osgi.framework.Version base) { VersionRange updateRange = null; if (!base.equals(org.osgi.framework.Version.emptyVersion)) { updateRange = new VersionRange(Version.emptyVersion, true, PublisherHelper.fromOSGiVersion(base), false); } else { updateRange = VersionRange.emptyRange; } return updateRange; }
public VersionRange checkVersionRange(String element, String attribute, String value) { try { if (value != null) return new VersionRange(value); } catch (IllegalArgumentException iae) { invalidAttributeValue(element, attribute, value); } catch (NullPointerException npe) { invalidAttributeValue(element, attribute, null); } return VersionRange.emptyRange; }
static VersionRange computeUpdateRange(org.osgi.framework.Version base) { VersionRange updateRange = null; if (!base.equals(org.osgi.framework.Version.emptyVersion)) { updateRange = new VersionRange(Version.emptyVersion, true, PublisherHelper.fromOSGiVersion(base), false); } else { updateRange = VersionRange.emptyRange; } return updateRange; }
static VersionRange computeUpdateRange(org.osgi.framework.Version base) { VersionRange updateRange = null; if (!base.equals(org.osgi.framework.Version.emptyVersion)) { updateRange = new VersionRange(Version.emptyVersion, true, PublisherHelper.fromOSGiVersion(base), false); } else { updateRange = VersionRange.emptyRange; } return updateRange; }
public VersionRange checkVersionRange(String element, String attribute, String value) { try { if (value != null) return new VersionRange(value); } catch (IllegalArgumentException iae) { invalidAttributeValue(element, attribute, value); } catch (NullPointerException npe) { invalidAttributeValue(element, attribute, null); } return VersionRange.emptyRange; }
/** * Returns whether the profile file for the given profile should be written in gzip format. */ private boolean shouldGzipFile(Profile profile) { //check system property controlling compression String format = EngineActivator.getContext().getProperty(EngineActivator.PROP_PROFILE_FORMAT); if (format != null && format.equals(EngineActivator.PROFILE_FORMAT_UNCOMPRESSED)) return false; //check whether the profile contains the p2 engine from 3.5.0 or earlier return profile.available(QueryUtil.createIUQuery("org.eclipse.equinox.p2.engine", new VersionRange("[0.0.0, 1.0.101)")), null).isEmpty(); //$NON-NLS-1$//$NON-NLS-2$ }
private IArtifactKey searchArtifact(String searchedId, Version searchedVersion, String classifier, IArtifactRepository repo) { //This is somewhat cheating since normally we should get the artifact key from the IUs that were representing the running system (e.g. we could get that info from the rollback repo) VersionRange range = searchedVersion != null ? new VersionRange(searchedVersion, true, searchedVersion, true) : null; ArtifactKeyQuery query = new ArtifactKeyQuery(classifier, searchedId, range); //TODO short-circuit the query when we find one? IQueryResult<IArtifactKey> keys = repo.query(query, null); if (!keys.isEmpty()) return keys.iterator().next(); return null; }
private IArtifactKey searchArtifact(String searchedId, Version searchedVersion, String classifier, IArtifactRepository repo) { //This is somewhat cheating since normally we should get the artifact key from the IUs that were representing the running system (e.g. we could get that info from the rollback repo) VersionRange range = searchedVersion != null ? new VersionRange(searchedVersion, true, searchedVersion, true) : null; ArtifactKeyQuery query = new ArtifactKeyQuery(classifier, searchedId, range); //TODO short-circuit the query when we find one? IQueryResult<IArtifactKey> keys = repo.query(query, null); if (!keys.isEmpty()) return keys.iterator().next(); return null; }
/** * The query will match descriptors whose <code>id</code> and <code>versionRange</code> * match the supplied key * @param key the artifact key to match. Cannot be <code>null</code>. */ public ArtifactDescriptorQuery(IArtifactKey key) { super(IArtifactDescriptor.class, createExpression(key.getId(), new VersionRange(key.getVersion(), true, key.getVersion(), true), null, null)); }
/** * The query will match descriptors whose <code>id</code> and <code>versionRange</code> * match the supplied key * @param key the artifact key to match. Cannot be <code>null</code>. */ public ArtifactDescriptorQuery(IArtifactKey key) { super(IArtifactDescriptor.class, createExpression(key.getId(), new VersionRange(key.getVersion(), true, key.getVersion(), true), null, null)); }
private IRequirement createOptionalRequirement(IInstallableUnit iu) { return MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), new VersionRange(iu.getVersion(), true, iu.getVersion(), true), null, true, false, true); }
public boolean isChecked(Object element) { if (profile != null) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); IQueryResult<IInstallableUnit> collector = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), new NullProgressMonitor()); if (collector.isEmpty()) { return true; } } return false; } };
private static IRequirement createStrictRequirementTo(IInstallableUnit unit) { VersionRange strictRange = new VersionRange(unit.getVersion(), true, unit.getVersion(), true); int min = 1; int max = Integer.MAX_VALUE; boolean greedy = true; IRequirement requirement = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), strictRange, unit.getFilter(), min, max, greedy); return requirement; } }
/** * Returns a version range which includes "equivalent" versions, i.e. versions with the same * major, minor, and micro version. */ private static VersionRange getRangeOfEquivalentVersions(Version version) { Integer major = (Integer) version.getSegment(0); Integer minor = (Integer) version.getSegment(1); Integer micro = (Integer) version.getSegment(2); VersionRange range = new VersionRange(Version.createOSGi(major, minor, micro), true, Version.createOSGi(major, minor, micro + 1), false); return range; }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }