View Javadoc
1   package org.apache.maven.plugin.ejb.stub;
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 java.io.File;
23  import java.util.Collection;
24  import java.util.LinkedList;
25  import java.util.List;
26  
27  import org.apache.maven.artifact.Artifact;
28  import org.apache.maven.artifact.handler.ArtifactHandler;
29  import org.apache.maven.artifact.handler.DefaultArtifactHandler;
30  import org.apache.maven.artifact.metadata.ArtifactMetadata;
31  import org.apache.maven.artifact.repository.ArtifactRepository;
32  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
33  import org.apache.maven.artifact.versioning.ArtifactVersion;
34  import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
35  import org.apache.maven.artifact.versioning.VersionRange;
36  
37  /**
38   * Stub
39   */
40  public class ArtifactStub
41      implements Artifact
42  {
43  
44      boolean hasClassifier;
45  
46      boolean resolved;
47  
48      boolean optional;
49  
50      boolean release;
51  
52      ArtifactHandler artifactHandler;
53  
54      File file;
55  
56      String baseVersion;
57  
58      String type;
59  
60      String classifier;
61  
62      String identifier;
63  
64      String dependencyConflictId;
65  
66      String downloadUrl;
67  
68      String selectedVersion;
69  
70      String artifactId;
71  
72      String groupId;
73  
74      String resolvedVersion;
75  
76      String scope;
77  
78      String version;
79  
80      VersionRange versionRange;
81  
82      public ArtifactStub()
83      {
84          type = "testtype";
85          scope = "testscope";
86          classifier = "testclassifier";
87          artifactHandler = new DefaultArtifactHandler();
88      }
89  
90      public void populate( MavenProjectBasicStub project )
91      {
92          groupId = project.getGroupId();
93          artifactId = project.getArtifactId();
94          version = project.getVersion();
95          versionRange = VersionRange.createFromVersion( version );
96      }
97  
98      public boolean hasClassifier()
99      {
100         return true;
101     }
102 
103     public String getBaseVersion()
104     {
105         return "Test Version";
106     }
107 
108     public void setBaseVersion( String version )
109     {
110         baseVersion = version;
111     }
112 
113     public void setFile( File _file )
114     {
115         file = _file;
116     }
117 
118     public File getFile()
119     {
120         return new File( "testfile" );
121     }
122 
123     public String getGroupId()
124     {
125         return groupId;
126     }
127 
128     public String getArtifactId()
129     {
130         return artifactId;
131     }
132 
133     public String getVersion()
134     {
135         return version;
136     }
137 
138     public void setVersion( String _version )
139     {
140         version = _version;
141     }
142 
143     public String getScope()
144     {
145         return scope;
146     }
147 
148     public String getType()
149     {
150         return type;
151     }
152 
153     public String getClassifier()
154     {
155         return classifier;
156     }
157 
158     public String getId()
159     {
160         return identifier;
161     }
162 
163     public String getDependencyConflictId()
164     {
165         return dependencyConflictId;
166     }
167 
168     public void addMetadata( ArtifactMetadata metadata )
169     {
170 
171     }
172 
173     public Collection getMetadataList()
174     {
175         return new LinkedList();
176     }
177 
178     public void setRepository( ArtifactRepository remoteRepository )
179     {
180 
181     }
182 
183     public ArtifactRepository getRepository()
184     {
185         return null;
186     }
187 
188     public void updateVersion( String version, ArtifactRepository localRepository )
189     {
190 
191     }
192 
193     public String getDownloadUrl()
194     {
195         return downloadUrl;
196     }
197 
198     public void setDownloadUrl( String _downloadUrl )
199     {
200         downloadUrl = _downloadUrl;
201     }
202 
203     public ArtifactFilter getDependencyFilter()
204     {
205         return null;
206     }
207 
208     public void setDependencyFilter( ArtifactFilter artifactFilter )
209     {
210 
211     }
212 
213     public ArtifactHandler getArtifactHandler()
214     {
215         return artifactHandler;
216     }
217 
218     public List getDependencyTrail()
219     {
220         return new LinkedList();
221     }
222 
223     public void setDependencyTrail( List dependencyTrail )
224     {
225 
226     }
227 
228     public void setScope( String _scope )
229     {
230         scope = _scope;
231     }
232 
233     public VersionRange getVersionRange()
234     {
235         return versionRange;
236     }
237 
238     public void setVersionRange( VersionRange newRange )
239     {
240 
241     }
242 
243     public void selectVersion( String version )
244     {
245         selectedVersion = version;
246     }
247 
248     public void setGroupId( String _groupId )
249     {
250         groupId = _groupId;
251     }
252 
253     public void setArtifactId( String _artifactId )
254     {
255         artifactId = _artifactId;
256     }
257 
258     public boolean isSnapshot()
259     {
260         return true;
261     }
262 
263     public void setResolved( boolean _resolved )
264     {
265         resolved = _resolved;
266     }
267 
268     public boolean isResolved()
269     {
270         return true;
271     }
272 
273     public void setResolvedVersion( String version )
274     {
275         resolvedVersion = version;
276     }
277 
278     public void setArtifactHandler( ArtifactHandler handler )
279     {
280 
281     }
282 
283     public boolean isRelease()
284     {
285         return true;
286     }
287 
288     public void setRelease( boolean _release )
289     {
290         release = _release;
291     }
292 
293     public List getAvailableVersions()
294     {
295         return new LinkedList();
296     }
297 
298     public void setAvailableVersions( List versions )
299     {
300 
301     }
302 
303     public boolean isOptional()
304     {
305         return true;
306     }
307 
308     public void setOptional( boolean _optional )
309     {
310         optional = _optional;
311     }
312 
313     public ArtifactVersion getSelectedVersion()
314         throws OverConstrainedVersionException
315     {
316         return null;
317     }
318 
319     public boolean isSelectedVersionKnown()
320         throws OverConstrainedVersionException
321     {
322         return true;
323     }
324 
325     public int compareTo( Artifact o )
326     {
327         // TODO Auto-generated method stub
328         return 0;
329     }
330 
331     public ArtifactMetadata getMetadata( Class<?> arg0 )
332     {
333         // TODO Auto-generated method stub
334         return null;
335     }
336 }