1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.spi.connector;
20
21 import java.io.File;
22 import java.nio.file.Path;
23 import java.util.Collections;
24 import java.util.List;
25
26 import org.eclipse.aether.RequestTrace;
27 import org.eclipse.aether.metadata.Metadata;
28 import org.eclipse.aether.repository.RemoteRepository;
29 import org.eclipse.aether.transfer.MetadataTransferException;
30 import org.eclipse.aether.transfer.TransferListener;
31
32
33
34
35
36 public final class MetadataDownload extends MetadataTransfer {
37
38 private String checksumPolicy = "";
39
40 private String context = "";
41
42 private List<RemoteRepository> repositories = Collections.emptyList();
43
44
45
46
47 public MetadataDownload() {
48
49 }
50
51
52
53
54
55
56
57
58
59
60 @Deprecated
61 public MetadataDownload(Metadata metadata, String context, File file, String checksumPolicy) {
62 this(metadata, context, file != null ? file.toPath() : null, checksumPolicy);
63 }
64
65
66
67
68
69
70
71
72
73
74 public MetadataDownload(Metadata metadata, String context, Path path, String checksumPolicy) {
75 setMetadata(metadata);
76 setPath(path);
77 setChecksumPolicy(checksumPolicy);
78 setRequestContext(context);
79 }
80
81 @Override
82 public MetadataDownload setMetadata(Metadata metadata) {
83 super.setMetadata(metadata);
84 return this;
85 }
86
87 @Deprecated
88 @Override
89 public MetadataDownload setFile(File file) {
90 super.setFile(file);
91 return this;
92 }
93
94 @Override
95 public MetadataDownload setPath(Path path) {
96 super.setPath(path);
97 return this;
98 }
99
100
101
102
103
104
105 public String getChecksumPolicy() {
106 return checksumPolicy;
107 }
108
109
110
111
112
113
114
115 public MetadataDownload setChecksumPolicy(String checksumPolicy) {
116 this.checksumPolicy = (checksumPolicy != null) ? checksumPolicy : "";
117 return this;
118 }
119
120
121
122
123
124
125 public String getRequestContext() {
126 return context;
127 }
128
129
130
131
132
133
134
135 public MetadataDownload setRequestContext(String context) {
136 this.context = (context != null) ? context : "";
137 return this;
138 }
139
140
141
142
143
144
145
146 public List<RemoteRepository> getRepositories() {
147 return repositories;
148 }
149
150
151
152
153
154
155
156
157 public MetadataDownload setRepositories(List<RemoteRepository> repositories) {
158 if (repositories == null) {
159 this.repositories = Collections.emptyList();
160 } else {
161 this.repositories = repositories;
162 }
163 return this;
164 }
165
166 @Override
167 public MetadataDownload setException(MetadataTransferException exception) {
168 super.setException(exception);
169 return this;
170 }
171
172 @Override
173 public MetadataDownload setListener(TransferListener listener) {
174 super.setListener(listener);
175 return this;
176 }
177
178 @Override
179 public MetadataDownload setTrace(RequestTrace trace) {
180 super.setTrace(trace);
181 return this;
182 }
183
184 @Override
185 public String toString() {
186 return getMetadata() + " - " + getPath();
187 }
188 }