/** * Checks if the given package id matches this dependency specification. * @param id the package id * @return {@code true} if matches */ public boolean matches(@Nonnull PackageId id) { return groupId.equals(id.getGroup()) && name.equals(id.getName()) && range.isInRange(id.getVersion()); }
/** * Returns the relative path of this package. please note that since 2.3 this also * includes the version, but never the extension (.zip). * * @param id the package id * @return the relative path of this package * @since 2.2 */ public String getRelativeInstallationPath(PackageId id) { StringBuilder b = new StringBuilder("/"); if (id.getGroup().length() > 0) { b.append(id.getGroup()); b.append("/"); } b.append(id.getName()); String v = id.getVersion().toString(); if (v.length() > 0) { b.append("-").append(v); } return b.toString(); }
/** * Creates a new dependency to the specified package id * @param id package id. */ public Dependency(@Nonnull PackageId id) { this(id.getGroup(), id.getName(), new VersionRange(id.getVersion())); }
/** * {@inheritDoc} * * Compares this id with the given one. */ public int compareTo(PackageId o) { int comp = group.compareTo(o.getGroup()); if (comp != 0) { return comp; } comp = name.compareTo(o.getName()); if (comp != 0) { return comp; } return version.compareTo(o.getVersion()); }
/** * {@inheritDoc} */ @Override public PackageId resolve(Dependency dependency, boolean onlyInstalled) throws IOException { PackageId bestId = null; for (PackageId id : packages()) { if (!onlyInstalled || isInstalled(id)) { if (dependency.matches(id)) { if (bestId == null || id.getVersion().compareTo(bestId.getVersion()) > 0) { bestId = id; } } } } return bestId; }
if (bestId == null || id.getVersion().compareTo(bestId.getVersion()) > 0) { bestId = id;
/** * Returns the snapshot id of this package. * @return the snapshot package id * @throws RepositoryException if an error occurs */ private PackageId getSnapshotId() throws RepositoryException { PackageId id = getDefinition().getId(); String group = id.getGroup(); if (group.length() == 0) { group = ".snapshot"; } else { group += "/.snapshot"; } return new PackageId( group, id.getName(), id.getVersion()); }
final Version packageVersion = jcrPackage.getDefinition().getId().getVersion();
group == null ? id.getGroup() : group, name == null ? id.getName() : name, version == null ? id.getVersion() : Version.create(version) ); String dstPath = getInstallationPath(newId) + ".zip";
Version pVersion = pId.getVersion(); && listedPackageId.getVersion().compareTo(pVersion) > 0) { newerPackageIdPerSubPackage.put(pId, listedPackageId); break;