1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.repository.legacy;
20
21 import org.apache.maven.repository.ArtifactTransferResource;
22 import org.apache.maven.wagon.resource.Resource;
23
24 @Deprecated
25 class MavenArtifact implements ArtifactTransferResource {
26
27 private String repositoryUrl;
28
29 private Resource resource;
30
31 private long transferStartTime;
32
33 MavenArtifact(String repositoryUrl, Resource resource) {
34 if (repositoryUrl == null) {
35 this.repositoryUrl = "";
36 } else if (!repositoryUrl.endsWith("/") && !repositoryUrl.isEmpty()) {
37 this.repositoryUrl = repositoryUrl + '/';
38 } else {
39 this.repositoryUrl = repositoryUrl;
40 }
41 this.resource = resource;
42
43 this.transferStartTime = System.currentTimeMillis();
44 }
45
46 public String getRepositoryUrl() {
47 return repositoryUrl;
48 }
49
50 public String getName() {
51 String name = resource.getName();
52
53 if (name == null) {
54 name = "";
55 } else if (name.startsWith("/")) {
56 name = name.substring(1);
57 }
58
59 return name;
60 }
61
62 public String getUrl() {
63 return getRepositoryUrl() + getName();
64 }
65
66 public long getContentLength() {
67 return resource.getContentLength();
68 }
69
70 public long getTransferStartTime() {
71 return transferStartTime;
72 }
73
74 @Override
75 public String toString() {
76 return getUrl();
77 }
78 }