1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.transport.wagon;
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.Transporter;
27 import org.eclipse.aether.spi.connector.transport.TransporterFactory;
28 import org.eclipse.aether.transfer.NoTransporterException;
29
30 import static java.util.Objects.requireNonNull;
31
32
33
34
35
36
37 @Named(WagonTransporterFactory.NAME)
38 public final class WagonTransporterFactory implements TransporterFactory {
39 public static final String NAME = "wagon";
40
41 private final WagonProvider wagonProvider;
42
43 private final WagonConfigurator wagonConfigurator;
44
45 private float priority = -1.0f;
46
47 @Inject
48 public WagonTransporterFactory(WagonProvider wagonProvider, WagonConfigurator wagonConfigurator) {
49 this.wagonProvider = wagonProvider;
50 this.wagonConfigurator = wagonConfigurator;
51 }
52
53 @Override
54 public float getPriority() {
55 return priority;
56 }
57
58
59
60
61
62
63
64 public WagonTransporterFactory setPriority(float priority) {
65 this.priority = priority;
66 return this;
67 }
68
69 @Override
70 public Transporter newInstance(RepositorySystemSession session, RemoteRepository repository)
71 throws NoTransporterException {
72 requireNonNull(session, "session cannot be null");
73 requireNonNull(repository, "repository cannot be null");
74
75 return new WagonTransporter(wagonProvider, wagonConfigurator, repository, session);
76 }
77 }