1 | |
package org.apache.maven.artifact.repository; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.artifact.Artifact; |
23 | |
import org.apache.maven.artifact.metadata.ArtifactMetadata; |
24 | |
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; |
25 | |
import org.apache.maven.wagon.repository.Repository; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public class DefaultArtifactRepository |
35 | |
extends Repository |
36 | |
implements ArtifactRepository |
37 | |
{ |
38 | |
private final ArtifactRepositoryLayout layout; |
39 | |
|
40 | |
private ArtifactRepositoryPolicy snapshots; |
41 | |
|
42 | |
private ArtifactRepositoryPolicy releases; |
43 | |
|
44 | |
private boolean uniqueVersion; |
45 | |
|
46 | |
private boolean blacklisted; |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout ) |
56 | |
{ |
57 | 112 | this( id, url, layout, null, null ); |
58 | 112 | } |
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ) |
69 | |
{ |
70 | 0 | super( id, url ); |
71 | 0 | this.layout = layout; |
72 | 0 | this.uniqueVersion = uniqueVersion; |
73 | 0 | } |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, |
85 | |
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) |
86 | |
{ |
87 | 142 | super( id, url ); |
88 | |
|
89 | 142 | this.layout = layout; |
90 | |
|
91 | 142 | if ( snapshots == null ) |
92 | |
{ |
93 | 112 | snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, |
94 | |
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); |
95 | |
} |
96 | |
|
97 | 142 | this.snapshots = snapshots; |
98 | |
|
99 | 142 | if ( releases == null ) |
100 | |
{ |
101 | 112 | releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, |
102 | |
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); |
103 | |
} |
104 | |
|
105 | 142 | this.releases = releases; |
106 | 142 | } |
107 | |
|
108 | |
public String pathOf( Artifact artifact ) |
109 | |
{ |
110 | 63 | return layout.pathOf( artifact ); |
111 | |
} |
112 | |
|
113 | |
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata ) |
114 | |
{ |
115 | 2 | return layout.pathOfRemoteRepositoryMetadata( artifactMetadata ); |
116 | |
} |
117 | |
|
118 | |
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) |
119 | |
{ |
120 | 3 | return layout.pathOfLocalRepositoryMetadata( metadata, repository ); |
121 | |
} |
122 | |
|
123 | |
public ArtifactRepositoryLayout getLayout() |
124 | |
{ |
125 | 15 | return layout; |
126 | |
} |
127 | |
|
128 | |
public ArtifactRepositoryPolicy getSnapshots() |
129 | |
{ |
130 | 13 | return snapshots; |
131 | |
} |
132 | |
|
133 | |
public ArtifactRepositoryPolicy getReleases() |
134 | |
{ |
135 | 28 | return releases; |
136 | |
} |
137 | |
|
138 | |
public String getKey() |
139 | |
{ |
140 | 3 | return getId(); |
141 | |
} |
142 | |
|
143 | |
public boolean isUniqueVersion() |
144 | |
{ |
145 | 0 | return uniqueVersion; |
146 | |
} |
147 | |
|
148 | |
public boolean isBlacklisted() |
149 | |
{ |
150 | 17 | return blacklisted; |
151 | |
} |
152 | |
|
153 | |
public void setBlacklisted( boolean blacklisted ) |
154 | |
{ |
155 | 13 | this.blacklisted = blacklisted; |
156 | 13 | } |
157 | |
} |