View Javadoc

1   package org.apache.maven.plugin.testing.stubs;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.metadata.ArtifactMetadata;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
26  import org.apache.maven.artifact.repository.Authentication;
27  import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
28  import org.apache.maven.repository.Proxy;
29  
30  import java.util.ArrayList;
31  import java.util.Collections;
32  import java.util.List;
33  
34  /**
35   * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
36   * @version $Id$
37   */
38  public class StubArtifactRepository
39      implements ArtifactRepository
40  {
41      private String baseDir = null;
42  
43      /**
44       * Default constructor
45       *
46       * @param dir the basedir
47       */
48      public StubArtifactRepository( String dir )
49      {
50          baseDir = dir;
51      }
52  
53      /**
54       * @return the <code>artifactId</code>.
55       * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOf(org.apache.maven.artifact.Artifact)
56       */
57      public String pathOf( Artifact artifact )
58      {
59          return artifact.getId();
60      }
61  
62      /**
63       * @return <code>null</code>.
64       * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfRemoteRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata)
65       */
66      public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
67      {
68          return null;
69      }
70  
71      /**
72       * @return the filename of this metadata on the local repository.
73       * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfLocalRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata, org.apache.maven.artifact.repository.ArtifactRepository)
74       */
75      public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
76      {
77          return metadata.getLocalFilename( repository );
78      }
79  
80      /**
81       * @return <code>null</code>.
82       * @see org.apache.maven.artifact.repository.ArtifactRepository#getUrl()
83       */
84      public String getUrl()
85      {
86          return null;
87      }
88  
89      /**
90       * @return <code>basedir</code>.
91       * @see org.apache.maven.artifact.repository.ArtifactRepository#getBasedir()
92       */
93      public String getBasedir()
94      {
95          return baseDir;
96      }
97  
98      /**
99       * @return <code>null</code>.
100      * @see org.apache.maven.artifact.repository.ArtifactRepository#getProtocol()
101      */
102     public String getProtocol()
103     {
104         return null;
105     }
106 
107     /**
108      * @return <code>null</code>.
109      * @see org.apache.maven.artifact.repository.ArtifactRepository#getId()
110      */
111     public String getId()
112     {
113         return null;
114     }
115 
116     /**
117      * @return <code>null</code>.
118      * @see org.apache.maven.artifact.repository.ArtifactRepository#getSnapshots()
119      */
120     public ArtifactRepositoryPolicy getSnapshots()
121     {
122         return null;
123     }
124 
125     /**
126      * @return <code>null</code>.
127      * @see org.apache.maven.artifact.repository.ArtifactRepository#getReleases()
128      */
129     public ArtifactRepositoryPolicy getReleases()
130     {
131         return null;
132     }
133 
134     /**
135      * @return <code>null</code>.
136      * @see org.apache.maven.artifact.repository.ArtifactRepository#getLayout()
137      */
138     public ArtifactRepositoryLayout getLayout()
139     {
140         return null;
141     }
142 
143     /**
144      * @return <code>null</code>.
145      * @see org.apache.maven.artifact.repository.ArtifactRepository#getKey()
146      */
147     public String getKey()
148     {
149         return null;
150     }
151 
152     /**
153      * @return <code>false</code>.
154      * @see org.apache.maven.artifact.repository.ArtifactRepository#isUniqueVersion()
155      */
156     public boolean isUniqueVersion()
157     {
158         return false;
159     }
160 
161     /**
162      * By default, do nothing.
163      *
164      * @see org.apache.maven.artifact.repository.ArtifactRepository#setBlacklisted(boolean)
165      */
166     public void setBlacklisted( boolean blackListed )
167     {
168         // nop
169     }
170 
171     /**
172      * @return <code>false</code>.
173      * @see org.apache.maven.artifact.repository.ArtifactRepository#isBlacklisted()
174      */
175     public boolean isBlacklisted()
176     {
177         return false;
178     }
179 
180     public Artifact find( Artifact artifact )
181     {
182         // TODO Auto-generated method stub
183         return null;
184     }
185 
186     public Authentication getAuthentication()
187     {
188         return null;
189     }
190 
191     public Proxy getProxy()
192     {
193         return null;
194     }
195 
196     public void setAuthentication( Authentication authentication )
197     {
198 
199     }
200 
201     public void setId( String id )
202     {
203 
204     }
205 
206     public void setLayout( ArtifactRepositoryLayout layout )
207     {
208 
209     }
210 
211     public void setProxy( Proxy proxy )
212     {
213 
214     }
215 
216     public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
217     {
218 
219     }
220 
221     public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
222     {
223 
224     }
225 
226     public void setUrl( String url )
227     {
228 
229     }
230 
231     public List<String> findVersions( Artifact artifact )
232     {
233         return Collections.emptyList();
234     }
235 
236     public boolean isProjectAware()
237     {
238         return false;
239     }
240 
241     public List<ArtifactRepository> getMirroredRepositories()
242     {
243         return new ArrayList<ArtifactRepository>( 0 );
244     }
245 
246     public void setMirroredRepositories( List<ArtifactRepository> artifactRepositories )
247     {
248         // no op
249     }
250 }