/** * Get the accessible (i.e. core or installed) extension instance from the passed namespace and matching the passed * feature/id. * * @param feature the extension id or provided feature (virtual extension) * @param namespace the namespace from where the extension is usable * @return the {@link Extension} instance * @since 10.0RC1 */ public Extension getAccessibleExtension(String feature, Namespace namespace) { return this.extensionManager.getAccessibleExtension(feature, namespace); }
/** * @param repositoryId the identifier of the remote repository * @return the repository */ public ExtensionRepository getRepository(String repositoryId) { return safe(this.extensionManager.getRepository(repositoryId)); }
/** * Search accessible (i.e. core or installed) extensions based of the provided query and only in the passed * namespace. * * @param namespace the namespace where to search * @param query the extension query used to filter and order the result * @return the found extensions descriptors, empty list if nothing could be found * @throws SearchException error when trying to search provided pattern * @since 10.0RC1 */ public IterableResult<Extension> searchAccessibleExtensions(Namespace namespace, ExtensionQuery query) throws SearchException { return this.extensionManager.searchAccessibleExtensions(namespace, query); } }
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 extensionDependency the extension dependency 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 * @since 3.4M1 * @deprecated since 5.3M1, use {@link #resolve(ExtensionDependency, String)} instead */ @Deprecated public Extension resolve(ExtensionDependency extensionDependency) { setError(null); Extension extension = null; try { extension = safe(this.extensionManager.resolveExtension(extensionDependency)); } catch (Exception e) { setError(e); } return extension; }
private void validateKnownFlavor(ExtensionId flavorId, String namespace) { if (flavorId.getVersion() != null) { try { // Get corresponding extension Extension flavor = this.extensionManager.resolveExtension(flavorId); // Filter allowed flavors on namespace if (this.namespaceResolver.isAllowed(flavor.getAllowedNamespaces(), namespace)) { // Directly add the flavor without trying to validate it first (99% of the time it's // valid or it means the distribution was broken and you probably want to know about it) this.foundFlavors.add(flavor); } } catch (ResolveException e) { this.logger.debug("Failed to resolve extension [{}]", flavorId, e); } } else { // Find a valid version of the flavor Extension flavor = findValidVersion(flavorId.getId(), namespace); if (flavor != null) { this.foundFlavors.add(flavor); } } }
/** * Search the provided extension as a dependency of another extension among all repositories including core and * local repositories. * <p> * The search is done in the following order: * <ul> * <li>Is it a core extension ?</li> * <li>Is it a local extension ?</li> * <li>Is this feature installed in current namespace or parent ?</li> * <li>Is it a remote extension in one of the configured remote repositories ?</li> * </ul> * The first one found is returned. * * @param extensionDependency the extension dependency to resolve * @param namespace the namespace where to search for the dependency * @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 * @since 5.3M1 */ public Extension resolve(ExtensionDependency extensionDependency, String namespace) { setError(null); Extension extension = null; try { extension = safe(this.extensionManager.resolveExtension(extensionDependency, namespace)); } catch (Exception e) { setError(e); } 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; }