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 java.io.File;
23 import java.util.Collections;
24 import java.util.List;
25
26 import org.apache.maven.artifact.Artifact;
27 import org.apache.maven.artifact.metadata.ArtifactMetadata;
28 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
29 import org.apache.maven.repository.Proxy;
30 import org.apache.maven.wagon.repository.Repository;
31
32
33
34
35
36
37
38
39 @Deprecated
40 public class DefaultArtifactRepository
41 extends Repository
42 implements ArtifactRepository
43 {
44 private ArtifactRepositoryLayout layout;
45
46 private ArtifactRepositoryPolicy snapshots;
47
48 private ArtifactRepositoryPolicy releases;
49
50 private boolean blacklisted;
51
52 private Authentication authentication;
53
54 private Proxy proxy;
55
56
57
58
59
60
61
62
63 public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout )
64 {
65 this( id, url, layout, null, null );
66 }
67
68
69
70
71
72
73
74
75
76 public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion )
77 {
78 super( id, url );
79 this.layout = layout;
80 }
81
82
83
84
85
86
87
88
89
90
91 public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
92 ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
93 {
94 super( id, url );
95
96 this.layout = layout;
97
98 if ( snapshots == null )
99 {
100 snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
101 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
102 }
103
104 this.snapshots = snapshots;
105
106 if ( releases == null )
107 {
108 releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
109 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
110 }
111
112 this.releases = releases;
113 }
114
115 public String pathOf( Artifact artifact )
116 {
117 return layout.pathOf( artifact );
118 }
119
120 public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
121 {
122 return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
123 }
124
125 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
126 {
127 return layout.pathOfLocalRepositoryMetadata( metadata, repository );
128 }
129
130 public void setLayout( ArtifactRepositoryLayout layout )
131 {
132 this.layout = layout;
133 }
134
135 public ArtifactRepositoryLayout getLayout()
136 {
137 return layout;
138 }
139
140 public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy snapshots )
141 {
142 this.snapshots = snapshots;
143 }
144
145 public ArtifactRepositoryPolicy getSnapshots()
146 {
147 return snapshots;
148 }
149
150 public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy releases )
151 {
152 this.releases = releases;
153 }
154
155 public ArtifactRepositoryPolicy getReleases()
156 {
157 return releases;
158 }
159
160 public String getKey()
161 {
162 return getId();
163 }
164
165 public boolean isBlacklisted()
166 {
167 return blacklisted;
168 }
169
170 public void setBlacklisted( boolean blacklisted )
171 {
172 this.blacklisted = blacklisted;
173 }
174
175 public String toString()
176 {
177 StringBuilder sb = new StringBuilder();
178
179 sb.append( " id: " ).append( getId() ).append( "\n" );
180 sb.append( " url: " ).append( getUrl() ).append( "\n" );
181 sb.append( " layout: " ).append( layout != null ? layout.getId() : "none" ).append( "\n" );
182
183 if ( snapshots != null )
184 {
185 sb.append( "snapshots: [enabled => " ).append( snapshots.isEnabled() );
186 sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]\n" );
187 }
188
189 if ( releases != null )
190 {
191 sb.append( " releases: [enabled => " ).append( releases.isEnabled() );
192 sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" );
193 }
194
195 return sb.toString();
196 }
197
198 public Artifact find( Artifact artifact )
199 {
200 File artifactFile = new File( getBasedir(), pathOf( artifact ) );
201
202
203
204 artifact.setFile( artifactFile );
205
206 if ( artifactFile.exists() )
207 {
208 artifact.setResolved( true );
209 }
210
211 return artifact;
212 }
213
214 public List<String> findVersions( Artifact artifact )
215 {
216 return Collections.emptyList();
217 }
218
219 public boolean isProjectAware()
220 {
221 return false;
222 }
223
224 public Authentication getAuthentication()
225 {
226 return authentication;
227 }
228
229 public void setAuthentication( Authentication authentication )
230 {
231 this.authentication = authentication;
232 }
233
234 public Proxy getProxy()
235 {
236 return proxy;
237 }
238
239 public void setProxy( Proxy proxy )
240 {
241 this.proxy = proxy;
242 }
243
244 public boolean isUniqueVersion()
245 {
246 return true;
247 }
248
249 }