/** * Returns the version of this package or and empty string if n/a. * @return the version of this package * @since 2.0 */ public String getVersionString() { return version.toString(); }
/** * Returns a download name in the form * {@code name [ "-" version ] ".zip"} * @return the download name * @since 2.0 */ public String getDownloadName() { StringBuilder str = new StringBuilder(name); if (version.toString().length() > 0) { str.append("-").append(version); } str.append(".zip"); return str.toString(); }
/** * Checks if this package id is valid in respect to JCR names. * @return {@code true} if the names are valid */ public boolean isValid() { return PackageId.isValid(group, name, version == null ? null : version.toString()); }
/** * Internally get the string representation, colon separated. * @param group group name * @param name name * @param version version * @return string version */ private static String getString(String group, String name, Version version) { return getString(group, name, version == null ? "" : version.toString()); }
/** * Returns the path of this package. please note that since 2.3 this also * includes the version, but never the extension (.zip). * * @return the path of this package * @since 2.2 * @deprecated As of 3.1.42, the storage location is implementation details. */ @Deprecated public String getInstallationPath() { StringBuilder b = new StringBuilder(ETC_PACKAGES_PREFIX); if (group.length() > 0) { b.append(group); b.append("/"); } b.append(name); if (version.toString().length() > 0) { b.append("-").append(version); } return b.toString(); }
/** * 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(); }
log.debug(packageVersion.toString() + " compareTo " + latestVersion.toString() + " = " + packageVersion.compareTo(latestVersion)); log.debug("Found a new latest version: {}", latestVersion.toString()); } else if (packageVersion.compareTo(configVersion) == 0) { configVersionEligible = false; log.debug("Current latest version: {}", latestVersion.toString()); if (configVersionEligible && latestVersion.equals(configVersion)) {
/** * {@inheritDoc} */ public JcrPackage createPackageFromPathFilterSets(final Collection<PathFilterSet> pathFilterSets, final Session session, final String groupName, final String name, String version, final ConflictResolution conflictResolution, final Map<String, String> packageDefinitionProperties) throws IOException, RepositoryException { final JcrPackageManager jcrPackageManager = packaging.getPackageManager(session); if (ConflictResolution.Replace.equals(conflictResolution)) { this.removePackage(jcrPackageManager, groupName, name, version); } else if (ConflictResolution.IncrementVersion.equals(conflictResolution)) { version = this.getNextVersion(jcrPackageManager, groupName, name, version).toString(); } final JcrPackage jcrPackage = jcrPackageManager.create(groupName, name, version); final JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition(); final DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter(); for (final PathFilterSet pathFilterSet : pathFilterSets) { workspaceFilter.add(pathFilterSet); } jcrPackageDefinition.setFilter(workspaceFilter, true); for (final Map.Entry<String, String> entry : packageDefinitionProperties.entrySet()) { jcrPackageDefinition.set(entry.getKey(), entry.getValue(), false); } session.save(); return jcrPackage; }