/** * Matches only the specified extension id or/and version on every namespaces. * * @param extensionId the extension identifier */ public ExtensionUpgradingEvent(String extensionId) { super(new ExtensionId(extensionId)); } }
/** * Create an instance of {@link ExtensionId}. * * @param id the id of the extension * @param version the version of the extension * @return the {@link ExtensionId} instance * @since 9.3RC1 */ public ExtensionId createExtensionId(String id, String version) { return new ExtensionId(id, version); }
/** * Matches only the specified extension id or/and version on every namespaces. * * @param extensionId the extension identifier * @since 9.0RC1 * @since 8.4.2 * @since 7.4.6 */ public ExtensionUpgradedEvent(String extensionId) { super(new ExtensionId(extensionId)); } }
/** * Matches only the specified extension id or/and version on every namespaces. * * @param extensionId the extension identifier */ public ExtensionUpgradeFailedEvent(String extensionId) { super(new ExtensionId(extensionId)); } }
private ExtensionId getExtensionId(Element extensionElement) { Node idNode = extensionElement.getElementsByTagName(ELEMENT_ID).item(0); Node versionNode = extensionElement.getElementsByTagName(ELEMENT_VERSION).item(0); return new ExtensionId(idNode.getTextContent(), this.factory.getVersion(versionNode.getTextContent())); }
/** * Create an {@link UninstallRequest} instance based on passed parameters. * <p> * Only uninstall from the provided namespace. * * @param id the identifier of the extension to uninstall * @param namespace the (optional) namespace from where to uninstall the extension; if {@code null} or empty, the * extension will be removed from root namespace * @return the {@link UninstallRequest} */ public UninstallRequest createUninstallRequest(String id, String namespace) { return createUninstallRequest(new ExtensionId(id, (Version) null), namespace); }
public List<ExtensionId> getSuggestedExtensions() { if (this.suggested == null) { this.suggested = new ArrayList<ExtensionId>(); for (Dependency mavenDependency : this.mavenModel.getDependencies()) { if (mavenDependency.isOptional()) { this.suggested.add(new ExtensionId(mavenDependency.getGroupId() + ":" + mavenDependency.getArtifactId(), mavenDependency.getVersion())); } } } return this.suggested; }
@Override @Deprecated public void setFeatures(Collection<String> features) { List<ExtensionId> extensionFeatures = new ArrayList<ExtensionId>(features.size()); for (String feature : features) { extensionFeatures.add(new ExtensionId(feature, getId().getVersion())); } setExtensionFeatures(extensionFeatures); }
public List<ExtensionDependency> getDependencies() { if (this.dependencies == null) { this.dependencies = new ArrayList<ExtensionDependency>(); for (Dependency mavenDependency : this.mavenModel.getDependencies()) { // XXX: not sure what to do about "provided" if (!mavenDependency.isOptional() && (mavenDependency.getScope().equals("compile") || mavenDependency.getScope().equals("runtime") || mavenDependency .getScope().equals("provided"))) { this.dependencies.add(new AetherExtensionDependency(new ExtensionId(mavenDependency.getGroupId() + ":" + mavenDependency.getArtifactId(), mavenDependency.getVersion()))); } } } return this.dependencies; }
/** * Indicate in an extension a list of provided "functionalities". Then when resolving extensions dependencies they * can be matched in this list. * * @return the {@link ExtensionId}s also provided by this extension, an empty collection if there is none * @since 8.0M1 */ default Collection<ExtensionId> getExtensionFeatures() { Collection<String> features = getFeatures(); List<ExtensionId> extensionFeatures = new ArrayList<ExtensionId>(features.size()); for (String feature : features) { extensionFeatures.add(new ExtensionId(feature, getId().getVersion())); } return extensionFeatures; }
/** * Start the asynchronous uninstallation plan creation process for an extension. * <p> * Only uninstall from the provided namespace. * * @param id the identifier of the extension to uninstall * @param namespace the (optional) namespace from where to uninstall the extension; if {@code null} or empty, the * extension will be removed from root namespace * @return the {@link Job} object which can be used to monitor the progress of the installation process, or * {@code null} in case of failure */ public Job createUninstallPlan(String id, String namespace) { return createUninstallPlan(createUninstallPlanRequest(new ExtensionId(id, (Version) null), namespace)); }
/** * Return the {@link ExtensionId} object that matches the passed feature id. * * @param featureId the id of the feature * @return the {@link ExtensionId} associated to the passed id * @since 8.0M1 */ default ExtensionId getExtensionFeature(String featureId) { return getFeatures().contains(featureId) ? new ExtensionId(featureId, getId().getVersion()) : null; }
@Override @Deprecated public void addFeature(String feature) { addExtensionFeature(new ExtensionId(feature, getId().getVersion())); }
public Map<String, Collection<LocalExtension>> getBackwardDependencies(String id, String version) { setError(null); Map<String, Collection<LocalExtension>> extensions; try { extensions = this.localExtensionRepository.getBackwardDependencies(new ExtensionId(id, version)); } catch (Exception e) { setError(e); extensions = null; } return extensions; }
public Extension resolve(String id, String version, String namespace) { setError(null); Extension extension; try { extension = this.extensionManager.resolveExtension(new ExtensionId(id, version), namespace); } catch (Exception e) { setError(e); extension = null; } return extension; }
/** * Get the extension handler corresponding to the given extension ID and version. The returned handler can be used * to get more information about the extension, such as the authors, an extension description, its license... * * @param id the extension id or provided feature (virtual extension) of the extension to resolve * @param version the specific version to resolve * @return the read-only handler corresponding to the requested extension, or {@code null} if the extension couldn't * be resolved, in which case {@link #getLastError()} contains the failure reason */ public Extension resolve(String id, String version) { setError(null); Extension extension = null; try { extension = safe(this.extensionManager.resolveExtension(new ExtensionId(id, version))); } catch (Exception e) { setError(e); } return extension; }
private Extension findValidVersion(String flavorId, String namespace, NavigableSet<Version> versions) { this.progressManager.pushLevelProgress(versions.size(), flavorId); try { // Try more recent first for (Version version : versions.descendingSet()) { this.progressManager.startStep(flavorId); Extension extension = tryInstallExtension(new ExtensionId(flavorId, version), namespace); this.progressManager.endStep(flavorId); if (extension != null) { return extension; } } } finally { this.progressManager.popLevelProgress(flavorId); } return null; } }
/** * @since 8.4 */ public static ExtensionId createExtensionId(Artifact artifact, ExtensionFactory factory) { String extensionId = MavenUtils.toExtensionId(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier()); return new ExtensionId(extensionId, factory != null ? factory.getVersion(artifact.getBaseVersion()) : new DefaultVersion(artifact.getBaseVersion())); } }
public Task install(String id, String version, String wiki) { if (!this.documentAccessBridge.hasProgrammingRights()) { setError(new TaskException("Need programming right to install an extension")); return null; } setError(null); InstallRequest installRequest = new InstallRequest(); installRequest.addExtension(new ExtensionId(id, version)); if (wiki != null) { installRequest.addNamespace(wiki); } Task task; try { task = this.taskManager.install(installRequest); } catch (TaskException e) { setError(e); task = null; } return task; }
protected void upgradeExtension(InstalledExtension extension, String namespace, Collection<Version> versionList) { for (Version version : versionList) { // Don't try to upgrade for lower versions but try to repair same version of the extension is invalid int compare = extension.getId().getVersion().compareTo(version); if (compare > 0 || (compare == 0 && extension.isValid(namespace))) { break; } // Only upgrade beta if the current is beta etc. if (extension.getId().getVersion().getType().ordinal() <= version.getType().ordinal()) { if (tryInstallExtension(new ExtensionId(extension.getId().getId(), version), namespace)) { break; } } } }