Skip to content

Commit

Permalink
[MRESOLVER-405] Get rid of component name free string literals (s4u#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas authored Sep 8, 2023
1 parent 4605205 commit 345f55d
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
* {@link org.eclipse.aether.spi.connector.transport.TransporterFactory transporters} and
* {@link org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory repository layouts} for the transfers.
*/
@Named("basic")
@Named(BasicRepositoryConnectorFactory.NAME)
public final class BasicRepositoryConnectorFactory implements RepositoryConnectorFactory, Service {
public static final String NAME = "basic";
private TransporterProvider transporterProvider;

private RepositoryLayoutProvider layoutProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
* emulating physically separated artifact caches per remote repository.
*/
@Singleton
@Named("enhanced")
@Named(EnhancedLocalRepositoryManagerFactory.NAME)
public class EnhancedLocalRepositoryManagerFactory implements LocalRepositoryManagerFactory, Service {
public static final String NAME = "enhanced";
private static final String CONFIG_PROP_TRACKING_FILENAME = "aether.enhancedLocalRepository.trackingFilename";

private static final String DEFAULT_TRACKING_FILENAME = "_remote.repositories";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
* Provides a Maven-2 repository layout for repositories with content type {@code "default"}.
*/
@Singleton
@Named("maven2")
@Named(Maven2RepositoryLayoutFactory.NAME)
public final class Maven2RepositoryLayoutFactory implements RepositoryLayoutFactory {
public static final String NAME = "maven2";

public static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
* Creates local repository managers for repository type {@code "simple"}.
*/
@Singleton
@Named("simple")
@Named(SimpleLocalRepositoryManagerFactory.NAME)
public class SimpleLocalRepositoryManagerFactory implements LocalRepositoryManagerFactory, Service {
public static final String NAME = "simple";
private float priority;

private LocalPathComposer localPathComposer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ protected ChecksumAlgorithmFactorySelector getChecksumAlgorithmFactorySelector(
protected Map<String, RepositoryLayoutFactory> getRepositoryLayoutFactories(
ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector) {
HashMap<String, RepositoryLayoutFactory> result = new HashMap<>();
result.put("maven2", new Maven2RepositoryLayoutFactory(checksumAlgorithmFactorySelector));
result.put(
Maven2RepositoryLayoutFactory.NAME,
new Maven2RepositoryLayoutFactory(checksumAlgorithmFactorySelector));
return result;
}

Expand Down Expand Up @@ -303,8 +305,8 @@ protected Map<String, ChecksumExtractor> getChecksumExtractors() {

protected Map<String, TransporterFactory> getTransporterFactories(Map<String, ChecksumExtractor> extractors) {
HashMap<String, TransporterFactory> result = new HashMap<>();
result.put("file", new FileTransporterFactory());
result.put("http", new HttpTransporterFactory(extractors));
result.put(FileTransporterFactory.NAME, new FileTransporterFactory());
result.put(HttpTransporterFactory.NAME, new HttpTransporterFactory(extractors));
return result;
}

Expand All @@ -329,7 +331,7 @@ protected BasicRepositoryConnectorFactory getBasicRepositoryConnectorFactory(
protected Map<String, RepositoryConnectorFactory> getRepositoryConnectorFactories(
BasicRepositoryConnectorFactory basicRepositoryConnectorFactory) {
HashMap<String, RepositoryConnectorFactory> result = new HashMap<>();
result.put("basic", basicRepositoryConnectorFactory);
result.put(BasicRepositoryConnectorFactory.NAME, basicRepositoryConnectorFactory);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
* <p>
* <em>Note:</em> Such repositories are read-only and uploads to them are generally not supported.
*/
@Named("classpath")
@Named(ClasspathTransporterFactory.NAME)
public final class ClasspathTransporterFactory implements TransporterFactory {
public static final String NAME = "classpath";

/**
* The key in the repository session's {@link RepositorySystemSession#getConfigProperties() configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
/**
* A transporter factory for repositories using the {@code file:} protocol.
*/
@Named("file")
@Named(FileTransporterFactory.NAME)
public final class FileTransporterFactory implements TransporterFactory {
public static final String NAME = "file";

private float priority;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
* A transporter factory for repositories using the {@code http:} or {@code https:} protocol. The provided transporters
* support uploads to WebDAV servers and resumable downloads.
*/
@Named("http")
@Named(HttpTransporterFactory.NAME)
public final class HttpTransporterFactory implements TransporterFactory {
public static final String NAME = "http";

private static Map<String, ChecksumExtractor> getManuallyCreatedExtractors() {
HashMap<String, ChecksumExtractor> map = new HashMap<>();
map.put(Nexus2ChecksumExtractor.NAME, new Nexus2ChecksumExtractor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
* that this factory merely serves as an adapter to the Wagon API and by itself does not provide any transport services
* unless one or more wagon implementations are registered with the {@link WagonProvider}.
*/
@Named("wagon")
@Named(WagonTransporterFactory.NAME)
public final class WagonTransporterFactory implements TransporterFactory, Service {
public static final String NAME = "wagon";

private WagonProvider wagonProvider;

Expand Down

0 comments on commit 345f55d

Please sign in to comment.