This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push: new 1bde99d3 Revert "[MRESOLVER-446] Introduce version scheme selector (#384)" 1bde99d3 is described below commit 1bde99d3aa56f581801bf5c0a3890902b6186002 Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Sat Dec 16 20:13:15 2023 +0100 Revert "[MRESOLVER-446] Introduce version scheme selector (#384)" This reverts commit ddf553420b839196d0534158dd1b9b427b99a188. --- .../impl/version/DefaultVersionSchemeSelector.java | 84 ---------------------- .../impl/version/GenericVersionSchemeProvider.java | 43 ----------- .../aether/spi/version/VersionSchemeSelector.java | 59 --------------- .../aether/supplier/RepositorySystemSupplier.java | 28 ++------ src/site/markdown/configuration.md | 1 - 5 files changed, 7 insertions(+), 208 deletions(-) diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/DefaultVersionSchemeSelector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/DefaultVersionSchemeSelector.java deleted file mode 100644 index 2e46f855..00000000 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/DefaultVersionSchemeSelector.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.eclipse.aether.internal.impl.version; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Collections; -import java.util.Map; - -import org.eclipse.aether.ConfigurationProperties; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.spi.version.VersionSchemeSelector; -import org.eclipse.aether.util.ConfigUtils; -import org.eclipse.aether.version.VersionScheme; - -import static java.util.Objects.requireNonNull; - -/** - * Default implementation. - * - * @since 2.0.0 - */ -@Singleton -@Named -public class DefaultVersionSchemeSelector implements VersionSchemeSelector { - static final String CONFIG_PROPS_PREFIX = ConfigurationProperties.PREFIX_AETHER + "versionScheme."; - - /** - * The name of the version scheme to be used in session. - * - * @configurationSource {@link RepositorySystemSession#getConfigProperties()} - * @configurationType {@link java.lang.String} - * @configurationDefaultValue {@link #DEFAULT_VERSION_SCHEME_NAME} - */ - public static final String CONFIG_PROP_VERSION_SCHEME_NAME = CONFIG_PROPS_PREFIX + "name"; - - public static final String DEFAULT_VERSION_SCHEME_NAME = GenericVersionSchemeProvider.NAME; - - private final Map<String, VersionScheme> versionSchemes; - - @Inject - public DefaultVersionSchemeSelector(Map<String, VersionScheme> versionSchemes) { - this.versionSchemes = requireNonNull(versionSchemes); - } - - @Override - public VersionScheme selectVersionScheme(String schemeName) { - requireNonNull(schemeName, "null schemeName"); - VersionScheme versionScheme = versionSchemes.get(schemeName); - if (versionScheme == null) { - throw new IllegalArgumentException("scheme not supported"); - } - return versionScheme; - } - - @Override - public VersionScheme selectVersionScheme(RepositorySystemSession session) { - return selectVersionScheme( - ConfigUtils.getString(session, DEFAULT_VERSION_SCHEME_NAME, CONFIG_PROP_VERSION_SCHEME_NAME)); - } - - @Override - public Map<String, VersionScheme> getVersionSchemes() { - return Collections.unmodifiableMap(versionSchemes); - } -} diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/GenericVersionSchemeProvider.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/GenericVersionSchemeProvider.java deleted file mode 100644 index 0839d66f..00000000 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/version/GenericVersionSchemeProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.eclipse.aether.internal.impl.version; - -import javax.inject.Named; -import javax.inject.Provider; -import javax.inject.Singleton; - -import org.eclipse.aether.util.version.GenericVersionScheme; -import org.eclipse.aether.version.VersionScheme; - -/** - * Provider of generic version scheme. - * - * @since 2.0.0 - */ -@Singleton -@Named(GenericVersionSchemeProvider.NAME) -public final class GenericVersionSchemeProvider implements Provider<VersionScheme> { - public static final String NAME = "generic"; - private final GenericVersionScheme genericVersionScheme = new GenericVersionScheme(); - - @Override - public VersionScheme get() { - return genericVersionScheme; - } -} diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/version/VersionSchemeSelector.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/version/VersionSchemeSelector.java deleted file mode 100644 index c80e1904..00000000 --- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/version/VersionSchemeSelector.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.eclipse.aether.spi.version; - -import java.util.Map; - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.version.VersionScheme; - -/** - * Selects a version scheme from the installed version schemes. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - * @since 2.0.0 - */ -public interface VersionSchemeSelector { - /** - * Tries to select a version scheme from the specified scheme name. - * - * @param schemeName The schemeName to select scheme for, must not be {@code null}. - * @return The scheme selected, never {@code null}. - * @throws IllegalArgumentException if asked scheme name is not supported. - * @throws NullPointerException if passed in names is {@code null}. - */ - VersionScheme selectVersionScheme(String schemeName); - - /** - * Tries to select a version scheme from the specified scheme name. - * - * @param session The repository system session from which to configure the scheme, must not be {@code null}. - * @return The scheme selected, never {@code null}. - * @throws IllegalArgumentException If none of the installed schemes cannot be selected. - * @throws NullPointerException if passed in session is {@code null}. - */ - VersionScheme selectVersionScheme(RepositorySystemSession session); - - /** - * Returns immutable map of all supported version schemes (maps scheme name to scheme instance). This represents - * ALL the schemes supported by Resolver, either provided out of the box, or extension installed. - */ - Map<String, VersionScheme> getVersionSchemes(); -} diff --git a/maven-resolver-supplier/src/main/java/org/eclipse/aether/supplier/RepositorySystemSupplier.java b/maven-resolver-supplier/src/main/java/org/eclipse/aether/supplier/RepositorySystemSupplier.java index 2ef5379d..a30b14ce 100644 --- a/maven-resolver-supplier/src/main/java/org/eclipse/aether/supplier/RepositorySystemSupplier.java +++ b/maven-resolver-supplier/src/main/java/org/eclipse/aether/supplier/RepositorySystemSupplier.java @@ -100,8 +100,6 @@ import org.eclipse.aether.internal.impl.synccontext.named.NameMapper; import org.eclipse.aether.internal.impl.synccontext.named.NameMappers; import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactory; import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactoryImpl; -import org.eclipse.aether.internal.impl.version.DefaultVersionSchemeSelector; -import org.eclipse.aether.internal.impl.version.GenericVersionSchemeProvider; import org.eclipse.aether.named.NamedLockFactory; import org.eclipse.aether.named.providers.FileLockNamedLockFactory; import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; @@ -122,7 +120,6 @@ import org.eclipse.aether.spi.io.FileProcessor; import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory; import org.eclipse.aether.spi.resolution.ArtifactResolverPostProcessor; import org.eclipse.aether.spi.synccontext.SyncContextFactory; -import org.eclipse.aether.spi.version.VersionSchemeSelector; import org.eclipse.aether.transport.apache.ApacheTransporterFactory; import org.eclipse.aether.transport.file.FileTransporterFactory; import org.eclipse.aether.util.version.GenericVersionScheme; @@ -441,14 +438,8 @@ public class RepositorySystemSupplier implements Supplier<RepositorySystem> { remoteRepositoryFilterManager); } - protected Map<String, VersionScheme> getVersionSchemes() { - HashMap<String, VersionScheme> result = new HashMap<>(); - result.put(GenericVersionSchemeProvider.NAME, new GenericVersionScheme()); - return result; - } - - protected VersionSchemeSelector getVersionSchemeSelector(Map<String, VersionScheme> versionSchemes) { - return new DefaultVersionSchemeSelector(versionSchemes); + protected VersionScheme getVersionScheme() { + return new GenericVersionScheme(); } // Maven provided @@ -493,14 +484,10 @@ public class RepositorySystemSupplier implements Supplier<RepositorySystem> { MetadataResolver metadataResolver, SyncContextFactory syncContextFactory, RepositoryEventDispatcher repositoryEventDispatcher, - VersionSchemeSelector versionSchemeSelector) { + VersionScheme versionScheme) { // from maven-resolver-provider - // TODO: hack here, until maven bits does not pick this change return new DefaultVersionRangeResolver( - metadataResolver, - syncContextFactory, - repositoryEventDispatcher, - versionSchemeSelector.selectVersionScheme(GenericVersionSchemeProvider.NAME)); + metadataResolver, syncContextFactory, repositoryEventDispatcher, versionScheme); } protected ModelBuilder getModelBuilder() { @@ -594,12 +581,11 @@ public class RepositorySystemSupplier implements Supplier<RepositorySystem> { offlineController, remoteRepositoryFilterManager); - Map<String, VersionScheme> versionSchemes = getVersionSchemes(); - VersionSchemeSelector versionSchemeSelector = getVersionSchemeSelector(versionSchemes); + VersionScheme versionScheme = getVersionScheme(); VersionResolver versionResolver = getVersionResolver(metadataResolver, syncContextFactory, repositoryEventDispatcher); - VersionRangeResolver versionRangeResolver = getVersionRangeResolver( - metadataResolver, syncContextFactory, repositoryEventDispatcher, versionSchemeSelector); + VersionRangeResolver versionRangeResolver = + getVersionRangeResolver(metadataResolver, syncContextFactory, repositoryEventDispatcher, versionScheme); Map<String, ArtifactResolverPostProcessor> artifactResolverPostProcessors = getArtifactResolverPostProcessors(checksumAlgorithmFactorySelector, trustedChecksumsSources); diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md index 4a07d985..34954dca 100644 --- a/src/site/markdown/configuration.md +++ b/src/site/markdown/configuration.md @@ -123,7 +123,6 @@ under the License. | 96. | `"aether.trustedChecksumsSource.summaryFile.basedir"` | `java.lang.String` | The basedir where checksums are. If relative, is resolved from local repository root. | `".checksums"` | 1.9.0 | No | Session Configuration | | 97. | `"aether.trustedChecksumsSource.summaryFile.originAware"` | `java.lang.Boolean` | Is source origin aware? | `true` | 1.9.0 | No | Session Configuration | | 98. | `"aether.updateCheckManager.sessionState"` | `java.lang.String` | Manages the session state, i.e. influences if the same download requests to artifacts/metadata will happen multiple times within the same RepositorySystemSession. If "enabled" will enable the session state. If "bypass" will enable bypassing (i.e. store all artifact ids/metadata ids which have been updates but not evaluating those). All other values lead to disabling the session state completely. | `"enabled"` | [...] -| 99. | `"aether.versionScheme.name"` | `java.lang.String` | The name of the version scheme to be used in session. | `"generic"` | 2.0.0 | No | Session Configuration | All properties which have `yes` in the column `Supports Repo ID Suffix` can be optionally configured specifically for a repository id. In that case the configuration property needs to be suffixed with a period followed by the repository id of the repository to configure, e.g. `aether.connector.http.headers.central` for repository with id `central`.