1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.transport.apache;
20
21 import javax.inject.Inject;
22 import javax.inject.Named;
23
24 import org.eclipse.aether.RepositorySystemSession;
25 import org.eclipse.aether.repository.RemoteRepository;
26 import org.eclipse.aether.spi.connector.transport.http.ChecksumExtractor;
27 import org.eclipse.aether.spi.connector.transport.http.HttpTransporter;
28 import org.eclipse.aether.spi.connector.transport.http.HttpTransporterFactory;
29 import org.eclipse.aether.transfer.NoTransporterException;
30
31 import static java.util.Objects.requireNonNull;
32
33
34
35
36
37 @Named(ApacheTransporterFactory.NAME)
38 public final class ApacheTransporterFactory implements HttpTransporterFactory {
39 public static final String NAME = "apache";
40
41 private float priority = 5.0f;
42
43 private final ChecksumExtractor checksumExtractor;
44
45 @Inject
46 public ApacheTransporterFactory(ChecksumExtractor checksumExtractor) {
47 this.checksumExtractor = requireNonNull(checksumExtractor, "checksumExtractor");
48 }
49
50 @Override
51 public float getPriority() {
52 return priority;
53 }
54
55
56
57
58
59
60
61 public ApacheTransporterFactory setPriority(float priority) {
62 this.priority = priority;
63 return this;
64 }
65
66 @Override
67 public HttpTransporter newInstance(RepositorySystemSession session, RemoteRepository repository)
68 throws NoTransporterException {
69 requireNonNull(session, "session cannot be null");
70 requireNonNull(repository, "repository cannot be null");
71
72 return new ApacheTransporter(repository, session, checksumExtractor);
73 }
74 }