1   package org.apache.maven.plugin.changelog.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.scm.ScmBranch;
23  import org.apache.maven.scm.ScmException;
24  import org.apache.maven.scm.ScmFileSet;
25  import org.apache.maven.scm.ScmVersion;
26  import org.apache.maven.scm.command.add.AddScmResult;
27  import org.apache.maven.scm.command.branch.BranchScmResult;
28  import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
29  import org.apache.maven.scm.command.checkin.CheckInScmResult;
30  import org.apache.maven.scm.command.checkout.CheckOutScmResult;
31  import org.apache.maven.scm.command.diff.DiffScmResult;
32  import org.apache.maven.scm.command.edit.EditScmResult;
33  import org.apache.maven.scm.command.export.ExportScmResult;
34  import org.apache.maven.scm.command.list.ListScmResult;
35  import org.apache.maven.scm.command.remove.RemoveScmResult;
36  import org.apache.maven.scm.command.status.StatusScmResult;
37  import org.apache.maven.scm.command.tag.TagScmResult;
38  import org.apache.maven.scm.command.unedit.UnEditScmResult;
39  import org.apache.maven.scm.command.update.UpdateScmResult;
40  import org.apache.maven.scm.manager.NoSuchScmProviderException;
41  import org.apache.maven.scm.manager.ScmManager;
42  import org.apache.maven.scm.provider.ScmProvider;
43  import org.apache.maven.scm.repository.ScmRepository;
44  import org.apache.maven.scm.repository.ScmRepositoryException;
45  import org.apache.maven.scm.repository.UnknownRepositoryStructure;
46  
47  import java.io.File;
48  import java.util.Date;
49  import java.util.List;
50  
51  /**
52   * @author Edwin Punzalan
53   * @version $Id: ScmManagerStub.java 803814 2009-08-13 09:24:45Z vsiveton $
54   */
55  public class ScmManagerStub
56      implements ScmManager
57  {
58      private ScmProvider scmProvider;
59  
60      /** {@inheritDoc} */
61      public ScmProvider getProviderByType( String string )
62          throws NoSuchScmProviderException
63      {
64          return null;
65      }
66  
67      /** {@inheritDoc} */
68      public ScmProvider getProviderByUrl( String string )
69          throws ScmRepositoryException, NoSuchScmProviderException
70      {
71          return null;
72      }
73  
74      /** {@inheritDoc} */
75      public ScmRepository makeProviderScmRepository( String string, File file )
76          throws ScmRepositoryException, UnknownRepositoryStructure, NoSuchScmProviderException
77      {
78          return null;
79      }
80  
81      /** {@inheritDoc} */
82      public ScmRepository makeScmRepository( String string )
83          throws ScmRepositoryException, NoSuchScmProviderException
84      {
85          return new ScmRepositoryStub();
86      }
87  
88      /** {@inheritDoc} */
89      public List validateScmRepository( String string )
90      {
91          return null;
92      }
93  
94      /** {@inheritDoc} */
95      public ScmProvider getProviderByRepository( ScmRepository scmRepository )
96          throws NoSuchScmProviderException
97      {
98          return new ScmProviderStub();
99      }
100 
101     public void setScmProvider( ScmProvider scmProvider )
102     {
103         this.scmProvider = scmProvider;
104     }
105 
106     public ScmProvider getScmProvider()
107     {
108         return scmProvider;
109     }
110 
111     /** {@inheritDoc} */
112     public void setScmProvider( String providerType, ScmProvider provider )
113     {
114         setScmProvider( provider );
115     }
116 
117     /** {@inheritDoc} */
118     public AddScmResult add( ScmRepository repository, ScmFileSet fileSet )
119         throws ScmException
120     {
121         return this.getProviderByRepository( repository ).add( repository, fileSet );
122     }
123 
124     /** {@inheritDoc} */
125     public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message )
126         throws ScmException
127     {
128         return this.getProviderByRepository( repository ).add( repository, fileSet, message );
129     }
130 
131     /** {@inheritDoc} */
132     public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName )
133         throws ScmException
134     {
135         return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName );
136     }
137 
138     /** {@inheritDoc} */
139     public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName, String message )
140         throws ScmException
141     {
142         return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName, message );
143     }
144 
145     /** {@inheritDoc} */
146     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
147                                          int numDays, ScmBranch branch )
148         throws ScmException
149     {
150         return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays,
151                                                                      branch );
152     }
153 
154     /** {@inheritDoc} */
155     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
156                                          int numDays, ScmBranch branch, String datePattern )
157         throws ScmException
158     {
159         return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays,
160                                                                      branch, datePattern );
161     }
162 
163     /** {@inheritDoc} */
164     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion,
165                                          ScmVersion endVersion )
166         throws ScmException
167     {
168         return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startVersion, endVersion );
169     }
170 
171     /** {@inheritDoc} */
172     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startRevision,
173                                          ScmVersion endRevision, String datePattern )
174         throws ScmException
175     {
176         return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startRevision, endRevision,
177                                                                      datePattern );
178     }
179 
180     /** {@inheritDoc} */
181     public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String message )
182         throws ScmException
183     {
184         return this.getProviderByRepository( repository ).checkIn( repository, fileSet, message );
185     }
186 
187     /** {@inheritDoc} */
188     public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message )
189         throws ScmException
190     {
191         return this.getProviderByRepository( repository ).checkIn( repository, fileSet, revision, message );
192     }
193 
194     /** {@inheritDoc} */
195     public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet )
196         throws ScmException
197     {
198         return this.getProviderByRepository( repository ).checkOut( repository, fileSet );
199     }
200 
201     /** {@inheritDoc} */
202     public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
203         throws ScmException
204     {
205         return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version );
206     }
207 
208     /** {@inheritDoc} */
209     public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, boolean recursive )
210         throws ScmException
211     {
212         return this.getProviderByRepository( repository ).checkOut( repository, fileSet, recursive );
213     }
214 
215     /** {@inheritDoc} */
216     public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
217                                        boolean recursive )
218         throws ScmException
219     {
220         return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version, recursive );
221     }
222 
223     /** {@inheritDoc} */
224     public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion,
225                                ScmVersion endVersion )
226         throws ScmException
227     {
228         return this.getProviderByRepository( repository ).diff( repository, fileSet, startVersion, endVersion );
229     }
230 
231     /** {@inheritDoc} */
232     public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet )
233         throws ScmException
234     {
235         return this.getProviderByRepository( repository ).edit( repository, fileSet );
236     }
237 
238     /** {@inheritDoc} */
239     public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet )
240         throws ScmException
241     {
242         return this.getProviderByRepository( repository ).export( repository, fileSet );
243     }
244 
245     /** {@inheritDoc} */
246     public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
247         throws ScmException
248     {
249         return this.getProviderByRepository( repository ).export( repository, fileSet, version );
250     }
251 
252     /** {@inheritDoc} */
253     public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String outputDirectory )
254         throws ScmException
255     {
256         return this.export( repository, fileSet, outputDirectory );
257     }
258 
259     /** {@inheritDoc} */
260     public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
261                                    String outputDirectory )
262         throws ScmException
263     {
264         return this.getProviderByRepository( repository ).export( repository, fileSet, version, outputDirectory );
265     }
266 
267     /** {@inheritDoc} */
268     public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version )
269         throws ScmException
270     {
271         return this.getProviderByRepository( repository ).list( repository, fileSet, recursive, version );
272     }
273 
274     /** {@inheritDoc} */
275     public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message )
276         throws ScmException
277     {
278         return this.getProviderByRepository( repository ).remove( repository, fileSet, message );
279     }
280 
281     /** {@inheritDoc} */
282     public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
283         throws ScmException
284     {
285         return this.getProviderByRepository( repository ).status( repository, fileSet );
286     }
287 
288     /** {@inheritDoc} */
289     public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName )
290         throws ScmException
291     {
292         return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName );
293     }
294 
295     /** {@inheritDoc} */
296     public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName, String message )
297         throws ScmException
298     {
299         return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName, message );
300     }
301 
302     /** {@inheritDoc} */
303     public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet )
304         throws ScmException
305     {
306         return this.getProviderByRepository( repository ).unedit( repository, fileSet );
307     }
308 
309     /** {@inheritDoc} */
310     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet )
311         throws ScmException
312     {
313         return this.getProviderByRepository( repository ).update( repository, fileSet );
314     }
315 
316     /** {@inheritDoc} */
317     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
318         throws ScmException
319     {
320         return this.getProviderByRepository( repository ).update( repository, fileSet, version );
321     }
322 
323     /** {@inheritDoc} */
324     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, boolean runChangelog )
325         throws ScmException
326     {
327         return this.getProviderByRepository( repository ).update( repository, fileSet, runChangelog );
328     }
329 
330     /** {@inheritDoc} */
331     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
332                                    boolean runChangelog )
333         throws ScmException
334     {
335         return this.getProviderByRepository( repository ).update( repository, fileSet, version, runChangelog );
336     }
337 
338     /** {@inheritDoc} */
339     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String datePattern )
340         throws ScmException
341     {
342         return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, datePattern );
343     }
344 
345     /** {@inheritDoc} */
346     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
347                                    String datePattern )
348         throws ScmException
349     {
350         return this.getProviderByRepository( repository ).update( repository, fileSet, version, datePattern );
351     }
352 
353     /** {@inheritDoc} */
354     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate )
355         throws ScmException
356     {
357         return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate );
358     }
359 
360     /** {@inheritDoc} */
361     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate )
362         throws ScmException
363     {
364         return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate );
365     }
366 
367     /** {@inheritDoc} */
368     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate, String datePattern )
369         throws ScmException
370     {
371         return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate,
372                                                                   datePattern );
373     }
374 
375     /** {@inheritDoc} */
376     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate,
377                                    String datePattern )
378         throws ScmException
379     {
380         return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate,
381                                                                   datePattern );
382     }
383 
384     /** {@inheritDoc} */
385     public void setScmProviderImplementation( String providerType, String providerImplementation )
386     {
387         // nop
388     }
389 }