public CoreExtension getCoreExtension(String id) { return this.coreExtensionRepository.getCoreExtension(id); }
private List<String> getEnvironmentPropertyList(String property) { // Get flavors from environment extension CoreExtension extension = this.coreRepository.getEnvironmentExtension(); if (extension != null) { String listString = extension.getProperty(property); return ExtensionUtils.importPropertyStringList(listString, true); } return Collections.emptyList(); }
@Override public boolean exists(String id) { return getWrapped().exists(id); }
public Collection<CoreExtension> getCoreExtensions() { return this.coreExtensionRepository.getCoreExtensions(); }
@Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } }
@Override public int countExtensions() { return getWrapped().countExtensions(); }
@Override public void initialize() throws InitializationException { this.standardRepositories.put(this.coreExtensionRepository.getDescriptor().getId(), this.coreExtensionRepository); this.standardRepositories.put(this.localExtensionRepository.getDescriptor().getId(), this.localExtensionRepository); this.standardRepositories.put(this.installedExtensionRepository.getDescriptor().getId(), this.installedExtensionRepository); }
/** * Get a list of core extensions provided by the current version of the platform. * * @return a list of read-only handlers corresponding to the core extensions */ public Collection<CoreExtension> getCoreExtensions() { return safe(this.coreExtensionRepository.getCoreExtensions()); }
@Override @Deprecated public Extension resolveExtension(ExtensionDependency extensionDependency) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionDependency); } catch (ResolveException notACoreExtension) { try { return this.localExtensionRepository.resolve(extensionDependency); } catch (ResolveException notALocalExtension) { return this.repositoryManager.resolve(extensionDependency); } } }
/** * Get the extension handler corresponding to the given core extension ID. The returned handler can be used to get * more information about the extension, such as the authors, an extension description, its license... * * @param feature the extension id or provided feature (virtual extension) of the extension to resolve * @return the read-only handler corresponding to the requested extension, or {@code null} if the extension isn't * provided by the platform */ public CoreExtension getCoreExtension(String feature) { return safe(this.coreExtensionRepository.getCoreExtension(feature)); } }
private void checkCoreExtension(String feature) throws InstallException { if (this.coreExtensionRepository.exists(feature)) { throw new InstallException( String.format("There is already a core extension covering feature [%s]", feature)); } }
@Override public CoreExtension getEnvironmentExtension() { return safe(getWrapped().getEnvironmentExtension()); } }
@Override public Collection<CoreExtension> getCoreExtensions() { return safe(getWrapped().getCoreExtensions()); }
@Override public Extension resolveExtension(ExtensionDependency extensionDependency, String namespace) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionDependency); } catch (ResolveException notACoreExtension) { InstalledExtension extension = this.installedExtensionRepository.getInstalledExtension(extensionDependency.getId(), namespace); if (extension != null && extensionDependency.getVersionConstraint().containsVersion(extension.getId().getVersion())) { return extension; } try { return this.localExtensionRepository.resolve(extensionDependency); } catch (ResolveException notALocalExtension) { return this.repositoryManager.resolve(extensionDependency); } } }
@Override public Extension getAccessibleExtension(String feature, Namespace namespace) { // Try installed extension Extension extension = this.installedExtensionRepository.getInstalledExtension(feature, namespace.serialize()); if (extension == null) { // Try core extension extension = this.coreExtensionRepository.getCoreExtension(feature); } return extension; }
protected List<String> getRecommendedVersions() { // Try configuration Object configurationValue = this.configuration.get().getProperty(CK_PREFIX + "recommendedVersions"); if (configurationValue != null) { if (configurationValue instanceof List) { return (List) configurationValue; } else { return ExtensionUtils.importPropertyStringList(configurationValue.toString(), true); } } // Try environment extension CoreExtensionRepository repository = this.coreExtensionRepository.get(); CoreExtension environmentExtension = repository.getEnvironmentExtension(); if (environmentExtension != null) { String listString = environmentExtension.getProperty("xwiki.extension.recommendedVersions"); return ExtensionUtils.importPropertyStringList(listString, true); } return null; }
@Override public CoreExtension getCoreExtension(String id) { return safe(getWrapped().getCoreExtension(id)); }
private void updateMissingBackwardDependencies(DefaultInstalledExtension installedExtension, String namespace) { // Add the extension as backward dependency for (ExtensionDependency dependency : installedExtension.getDependencies()) { if (!dependency.isOptional() && !this.coreExtensionRepository.exists(dependency.getId())) { // Get the extension for the dependency feature for the provided namespace DefaultInstalledExtension dependencyLocalExtension = (DefaultInstalledExtension) getInstalledExtension(dependency.getId(), namespace); if (dependencyLocalExtension != null) { ExtensionId feature = dependencyLocalExtension.getExtensionFeature(dependency.getId()); // Make sure to register backward dependency on the right namespace InstalledFeature dependencyInstalledExtension = addInstalledFeatureToCache(feature, namespace, dependencyLocalExtension, false); dependencyInstalledExtension.root.backwardDependencies.add(installedExtension); } } } }
@Override public Map<String, Object> provideData() { Map<String, Object> jsonMap = new HashMap<>(); String instanceId = this.instanceIdManagerProvider.get().getInstanceId().toString(); jsonMap.put(PROPERTY_INSTANCE_ID, instanceId); CoreExtension distributionExtension = this.coreExtensionRepository.getEnvironmentExtension(); if (distributionExtension != null) { String distributionId = distributionExtension.getId().getId(); if (distributionId != null) { jsonMap.put(PROPERTY_DISTRIBUTION_ID, distributionId); } Version distributionVersion = distributionExtension.getId().getVersion(); if (distributionVersion != null) { jsonMap.put(PROPERTY_DISTRIBUTION_VERSION, distributionVersion.toString()); } Collection<String> features = distributionExtension.getFeatures(); if (!features.isEmpty()) { jsonMap.put(PROPERTY_DISTRIBUTION_FEATURES, distributionExtension.getFeatures().toArray()); } } return jsonMap; } }