1 package org.apache.maven.shared.dependencies.collect.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.List;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.artifact.metadata.ArtifactMetadata;
26 import org.apache.maven.artifact.repository.ArtifactRepository;
27 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
28 import org.apache.maven.artifact.repository.Authentication;
29 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
30 import org.apache.maven.repository.Proxy;
31 import org.sonatype.aether.repository.RemoteRepository;
32 import org.sonatype.aether.repository.RepositoryPolicy;
33
34
35
36
37
38
39
40 public class Maven30ArtifactRepositoryAdapter implements ArtifactRepository
41 {
42
43 private RemoteRepository remoteRepository;
44
45
46
47
48 public Maven30ArtifactRepositoryAdapter( RemoteRepository remoteRepository )
49 {
50 this.remoteRepository = remoteRepository;
51 }
52
53 @Override
54 public String pathOf( Artifact artifact )
55 {
56 throw new UnsupportedOperationException();
57 }
58
59 @Override
60 public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
61 {
62 throw new UnsupportedOperationException();
63 }
64
65 @Override
66 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
67 {
68 throw new UnsupportedOperationException();
69 }
70
71 @Override
72 public String getUrl()
73 {
74 return remoteRepository.getUrl();
75 }
76
77 @Override
78 public void setUrl( String url )
79 {
80 throw new UnsupportedOperationException();
81 }
82
83 @Override
84 public String getBasedir()
85 {
86 throw new UnsupportedOperationException();
87 }
88
89 @Override
90 public String getProtocol()
91 {
92 throw new UnsupportedOperationException();
93 }
94
95 @Override
96 public String getId()
97 {
98 return remoteRepository.getId();
99 }
100
101 @Override
102 public void setId( String id )
103 {
104 throw new UnsupportedOperationException();
105 }
106
107 @Override
108 public ArtifactRepositoryPolicy getSnapshots()
109 {
110 throw new UnsupportedOperationException();
111 }
112
113 @Override
114 public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
115 {
116 throw new UnsupportedOperationException();
117 }
118
119 @Override
120 public ArtifactRepositoryPolicy getReleases()
121 {
122 throw new UnsupportedOperationException();
123 }
124
125 @Override
126 public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
127 {
128 throw new UnsupportedOperationException();
129 }
130
131 @Override
132 public ArtifactRepositoryLayout getLayout()
133 {
134 throw new UnsupportedOperationException();
135 }
136
137 @Override
138 public void setLayout( ArtifactRepositoryLayout layout )
139 {
140 throw new UnsupportedOperationException();
141 }
142
143 @Override
144 public String getKey()
145 {
146 throw new UnsupportedOperationException();
147 }
148
149 @Override
150 public boolean isUniqueVersion()
151 {
152 throw new UnsupportedOperationException();
153 }
154
155 @Override
156 public boolean isBlacklisted()
157 {
158 throw new UnsupportedOperationException();
159 }
160
161 @Override
162 public void setBlacklisted( boolean blackListed )
163 {
164 throw new UnsupportedOperationException();
165 }
166
167 @Override
168 public Artifact find( Artifact artifact )
169 {
170 throw new UnsupportedOperationException();
171 }
172
173 @Override
174 public List<String> findVersions( Artifact artifact )
175 {
176 throw new UnsupportedOperationException();
177 }
178
179 @Override
180 public boolean isProjectAware()
181 {
182 throw new UnsupportedOperationException();
183 }
184
185 @Override
186 public void setAuthentication( Authentication authentication )
187 {
188 throw new UnsupportedOperationException();
189 }
190
191 @Override
192 public Authentication getAuthentication()
193 {
194 throw new UnsupportedOperationException();
195 }
196
197 @Override
198 public void setProxy( Proxy proxy )
199 {
200 throw new UnsupportedOperationException();
201 }
202
203 @Override
204 public Proxy getProxy()
205 {
206 throw new UnsupportedOperationException();
207 }
208
209 @Override
210 public String toString()
211 {
212 StringBuilder sb = new StringBuilder();
213
214 sb.append( " id: " ).append( getId() ).append( "\n" );
215 sb.append( " url: " ).append( getUrl() ).append( "\n" );
216 sb.append( " layout: " ).append( "default" ).append( "\n" );
217
218 RepositoryPolicy snapshotPolicy = remoteRepository.getPolicy( true );
219 sb.append( "snapshots: [enabled => " ).append( snapshotPolicy.isEnabled() );
220 sb.append( ", update => " ).append( snapshotPolicy.getUpdatePolicy() ).append( "]\n" );
221
222 RepositoryPolicy releasePolicy = remoteRepository.getPolicy( false );
223 sb.append( " releases: [enabled => " ).append( releasePolicy.isEnabled() );
224 sb.append( ", update => " ).append( releasePolicy.getUpdatePolicy() ).append( "]\n" );
225
226 return sb.toString();
227 }
228
229
230 @Override
231 public int hashCode()
232 {
233 return remoteRepository.hashCode();
234 }
235
236 @Override
237 public boolean equals( Object obj )
238 {
239 if ( this == obj )
240 {
241 return true;
242 }
243 if ( obj == null )
244 {
245 return false;
246 }
247 if ( getClass() != obj.getClass() )
248 {
249 return false;
250 }
251
252 Maven30ArtifactRepositoryAdapter other = (Maven30ArtifactRepositoryAdapter) obj;
253 if ( remoteRepository == null )
254 {
255 if ( other.remoteRepository != null )
256 {
257 return false;
258 }
259 }
260 else if ( !remoteRepository.equals( other.remoteRepository ) )
261 {
262 return false;
263 }
264 return true;
265 }
266 }