1 package org.apache.maven.scm.provider;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.scm.CommandParameters;
23 import org.apache.maven.scm.ScmBranch;
24 import org.apache.maven.scm.ScmBranchParameters;
25 import org.apache.maven.scm.ScmException;
26 import org.apache.maven.scm.ScmFile;
27 import org.apache.maven.scm.ScmFileSet;
28 import org.apache.maven.scm.ScmTagParameters;
29 import org.apache.maven.scm.ScmVersion;
30 import org.apache.maven.scm.command.add.AddScmResult;
31 import org.apache.maven.scm.command.blame.BlameScmRequest;
32 import org.apache.maven.scm.command.blame.BlameScmResult;
33 import org.apache.maven.scm.command.branch.BranchScmResult;
34 import org.apache.maven.scm.command.changelog.ChangeLogScmRequest;
35 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
36 import org.apache.maven.scm.command.checkin.CheckInScmResult;
37 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
38 import org.apache.maven.scm.command.diff.DiffScmResult;
39 import org.apache.maven.scm.command.edit.EditScmResult;
40 import org.apache.maven.scm.command.export.ExportScmResult;
41 import org.apache.maven.scm.command.info.InfoScmResult;
42 import org.apache.maven.scm.command.list.ListScmResult;
43 import org.apache.maven.scm.command.mkdir.MkdirScmResult;
44 import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
45 import org.apache.maven.scm.command.remove.RemoveScmResult;
46 import org.apache.maven.scm.command.status.StatusScmResult;
47 import org.apache.maven.scm.command.tag.TagScmResult;
48 import org.apache.maven.scm.command.unedit.UnEditScmResult;
49 import org.apache.maven.scm.command.untag.UntagScmResult;
50 import org.apache.maven.scm.command.update.UpdateScmResult;
51 import org.apache.maven.scm.log.ScmLogger;
52 import org.apache.maven.scm.repository.ScmRepository;
53 import org.apache.maven.scm.repository.ScmRepositoryException;
54 import org.apache.maven.scm.repository.UnknownRepositoryStructure;
55
56 import java.io.File;
57 import java.util.ArrayList;
58 import java.util.Collections;
59 import java.util.Date;
60 import java.util.List;
61
62
63
64
65
66
67
68
69
70
71 public class ScmProviderStub
72 implements ScmProvider
73 {
74
75 private String scmType, scmSpecificFilename;
76
77 private List<ScmLogger> loggers = new ArrayList<ScmLogger>();
78
79 private boolean requiresEditmode;
80
81 private ScmProviderRepository scmProviderRepository = new ScmProviderRepositoryStub();
82
83 private List<String> errors = new ArrayList<String>();
84
85 private AddScmResult addScmResult;
86
87 private BranchScmResult branchScmResult;
88
89 private CheckInScmResult checkInScmResult;
90
91 private CheckOutScmResult checkOutScmResult;
92
93 private ChangeLogScmResult changeLogScmResult;
94
95 private DiffScmResult diffScmResult;
96
97 private RemoveScmResult removeScmResult;
98
99 private StatusScmResult statusScmResult;
100
101 private TagScmResult tagScmResult;
102
103 private UpdateScmResult updateScmResult;
104
105 private EditScmResult editScmResult;
106
107 private UnEditScmResult unEditScmResult;
108
109 private ListScmResult listScmResult;
110
111 private ExportScmResult exportScmResult;
112
113 private BlameScmResult blameScmResult;
114
115 private MkdirScmResult mkdirScmResult;
116
117 private UntagScmResult untagScmResult;
118
119
120
121
122 public ScmProviderStub()
123 {
124 setScmSpecificFilename( "" );
125 setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) );
126 setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) );
127 setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
128 setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
129 setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
130 setDiffScmResult( new DiffScmResult( "", "", "", true ) );
131 setEditScmResult( new EditScmResult( "", "", "", true ) );
132 setExportScmResult( new ExportScmResult( "", "", "", true ) );
133 setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
134 setStatusScmResult( new StatusScmResult( "", "", "", true ) );
135 setTagScmResult( new TagScmResult( "", "", "", true ) );
136 setUnEditScmResult( new UnEditScmResult( "", "", "", true ) );
137 setUntagScmResult( new UntagScmResult( "", "", "", true ) );
138 setUpdateScmResult( new UpdateScmResult( "", "", "", true ) );
139 setBlameScmResult( new BlameScmResult( "", "", "", true ) );
140 setMkdirScmResult( new MkdirScmResult( "", "", "", true ) );
141 }
142
143
144
145
146 public String sanitizeTagName( String tag )
147 {
148 return tag;
149 }
150
151
152
153
154 public boolean validateTagName( String tag )
155 {
156 return true;
157 }
158
159
160
161
162 public String getScmType()
163 {
164 return scmType;
165 }
166
167 public void setScmSpecificFilename( String scmSpecificFilename )
168 {
169 this.scmSpecificFilename = scmSpecificFilename;
170 }
171
172
173
174
175 public void addListener( ScmLogger logger )
176 {
177 loggers.add( logger );
178 }
179
180 public boolean requiresEditMode()
181 {
182 return requiresEditmode;
183 }
184
185 public void setAddScmResult( AddScmResult addScmResult )
186 {
187 this.addScmResult = addScmResult;
188 }
189
190 public AddScmResult getAddScmResult()
191 {
192 return addScmResult;
193 }
194
195 public void setBranchScmResult( BranchScmResult branchScmResult )
196 {
197 this.branchScmResult = branchScmResult;
198 }
199
200 public BranchScmResult getBranchScmResult()
201 {
202 return branchScmResult;
203 }
204
205 public void setCheckInScmResult( CheckInScmResult checkInScmResult )
206 {
207 this.checkInScmResult = checkInScmResult;
208 }
209
210 public CheckInScmResult getCheckInScmResult()
211 {
212 return checkInScmResult;
213 }
214
215 public void setCheckOutScmResult( CheckOutScmResult checkOutScmResult )
216 {
217 this.checkOutScmResult = checkOutScmResult;
218 }
219
220 public CheckOutScmResult getCheckOutScmResult()
221 {
222 return checkOutScmResult;
223 }
224
225 public void setChangeLogScmResult( ChangeLogScmResult changeLogScmResult )
226 {
227 this.changeLogScmResult = changeLogScmResult;
228 }
229
230 public ChangeLogScmResult getChangeLogScmResult()
231 {
232 return changeLogScmResult;
233 }
234
235 public void setDiffScmResult( DiffScmResult diffScmResult )
236 {
237 this.diffScmResult = diffScmResult;
238 }
239
240 public DiffScmResult getDiffScmResult()
241 {
242 return diffScmResult;
243 }
244
245 public ExportScmResult getExportScmResult()
246 {
247 return exportScmResult;
248 }
249
250 public void setExportScmResult( ExportScmResult exportScmResult )
251 {
252 this.exportScmResult = exportScmResult;
253 }
254
255 public void setTagScmResult( TagScmResult tagScmResult )
256 {
257 this.tagScmResult = tagScmResult;
258 }
259
260 public TagScmResult getTagScmResult()
261 {
262 return tagScmResult;
263 }
264
265 public void setUntagScmResult( UntagScmResult untagScmResult )
266 {
267 this.untagScmResult = untagScmResult;
268 }
269
270 public UntagScmResult getUntagScmResult()
271 {
272 return untagScmResult;
273 }
274
275 public void setRemoveScmResult( RemoveScmResult removeScmResult )
276 {
277 this.removeScmResult = removeScmResult;
278 }
279
280 public RemoveScmResult getRemoveScmResult()
281 {
282 return removeScmResult;
283 }
284
285 public void setStatusScmResult( StatusScmResult statusScmResult )
286 {
287 this.statusScmResult = statusScmResult;
288 }
289
290 public StatusScmResult getStatusScmResult()
291 {
292 return statusScmResult;
293 }
294
295 public void setUpdateScmResult( UpdateScmResult updateScmResult )
296 {
297 this.updateScmResult = updateScmResult;
298 }
299
300 public UpdateScmResult getUpdateScmResult()
301 {
302 return updateScmResult;
303 }
304
305 public void setEditScmResult( EditScmResult editScmResult )
306 {
307 this.editScmResult = editScmResult;
308 }
309
310 public EditScmResult getEditScmResult()
311 {
312 return editScmResult;
313 }
314
315 public void setUnEditScmResult( UnEditScmResult unEditScmResult )
316 {
317 this.unEditScmResult = unEditScmResult;
318 }
319
320 public UnEditScmResult getUnEditScmResult()
321 {
322 return unEditScmResult;
323 }
324
325 public void setListScmResult( ListScmResult listScmResult )
326 {
327 this.listScmResult = listScmResult;
328 }
329
330 public ListScmResult getListScmResult()
331 {
332 return listScmResult;
333 }
334
335 public void setBlameScmResult( BlameScmResult blameScmResult )
336 {
337 this.blameScmResult = blameScmResult;
338 }
339
340 public BlameScmResult getBlameScmResult()
341 {
342 return blameScmResult;
343 }
344
345 public MkdirScmResult getMkdirScmResult()
346 {
347 return mkdirScmResult;
348 }
349
350 public void setMkdirScmResult( MkdirScmResult mkdirScmResult )
351 {
352 this.mkdirScmResult = mkdirScmResult;
353 }
354
355
356
357
358 public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
359 throws ScmRepositoryException
360 {
361 return scmProviderRepository;
362 }
363
364
365
366
367 public ScmProviderRepository makeProviderScmRepository( File path )
368 throws ScmRepositoryException, UnknownRepositoryStructure
369 {
370 return scmProviderRepository;
371 }
372
373
374
375
376 public List<String> validateScmUrl( String scmSpecificUrl, char delimiter )
377 {
378 return errors;
379 }
380
381
382
383
384 public String getScmSpecificFilename()
385 {
386 return scmSpecificFilename;
387 }
388
389
390
391
392 public AddScmResult add( ScmRepository repository, ScmFileSet fileSet )
393 throws ScmException
394 {
395 return getAddScmResult();
396 }
397
398
399
400
401 public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message )
402 throws ScmException
403 {
404 return getAddScmResult();
405 }
406
407 public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, CommandParameters commandParameters )
408 throws ScmException
409 {
410 return getAddScmResult();
411 }
412
413
414
415
416 public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName )
417 throws ScmException
418 {
419 return getBranchScmResult();
420 }
421
422
423
424
425 public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName, String message )
426 throws ScmException
427 {
428 return getBranchScmResult();
429 }
430
431
432
433
434 public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName,
435 ScmBranchParameters scmBranchParameters )
436 throws ScmException
437 {
438 return getBranchScmResult();
439 }
440
441
442
443
444 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
445 int numDays, String branch )
446 throws ScmException
447 {
448 return getChangeLogScmResult();
449 }
450
451
452
453
454 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
455 int numDays, String branch, String datePattern )
456 throws ScmException
457 {
458 return getChangeLogScmResult();
459 }
460
461
462
463
464 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag )
465 throws ScmException
466 {
467 return getChangeLogScmResult();
468 }
469
470
471
472
473 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag,
474 String datePattern )
475 throws ScmException
476 {
477 return getChangeLogScmResult();
478 }
479
480
481
482
483 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
484 int numDays, ScmBranch branch )
485 throws ScmException
486 {
487 return getChangeLogScmResult();
488 }
489
490
491
492
493 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
494 int numDays, ScmBranch branch, String datePattern )
495 throws ScmException
496 {
497 return getChangeLogScmResult();
498 }
499
500 public ChangeLogScmResult changeLog( ChangeLogScmRequest scmRequest )
501 throws ScmException
502 {
503 return getChangeLogScmResult();
504 }
505
506
507
508
509 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion,
510 ScmVersion endVersion )
511 throws ScmException
512 {
513 return getChangeLogScmResult();
514 }
515
516
517
518
519 public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startRevision,
520 ScmVersion endRevision, String datePattern )
521 throws ScmException
522 {
523 return getChangeLogScmResult();
524 }
525
526
527
528
529 public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String tag, String message )
530 throws ScmException
531 {
532 return getCheckInScmResult();
533 }
534
535
536
537
538 public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String message )
539 throws ScmException
540 {
541 return getCheckInScmResult();
542 }
543
544
545
546
547 public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message )
548 throws ScmException
549 {
550 return getCheckInScmResult();
551 }
552
553
554
555
556 public CheckOutScmResult checkOut( ScmRepository scmRepository, ScmFileSet scmFileSet, String tag,
557 boolean recursive )
558 throws ScmException
559 {
560 return getCheckOutScmResult();
561 }
562
563
564
565
566 public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, String tag )
567 throws ScmException
568 {
569 return getCheckOutScmResult();
570 }
571
572
573
574
575 public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet )
576 throws ScmException
577 {
578 return getCheckOutScmResult();
579 }
580
581
582
583
584 public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
585 throws ScmException
586 {
587 return getCheckOutScmResult();
588 }
589
590
591
592
593 public CheckOutScmResult checkOut( ScmRepository scmRepository, ScmFileSet scmFileSet, boolean recursive )
594 throws ScmException
595 {
596 return getCheckOutScmResult();
597 }
598
599
600
601
602 public CheckOutScmResult checkOut( ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version,
603 boolean recursive )
604 throws ScmException
605 {
606 return getCheckOutScmResult();
607 }
608
609 @Override
610 public CheckOutScmResult checkOut( ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version,
611 CommandParameters commandParameters )
612 throws ScmException
613 {
614 return getCheckOutScmResult();
615 }
616
617
618
619
620 public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, String startRevision, String endRevision )
621 throws ScmException
622 {
623 return getDiffScmResult();
624 }
625
626
627
628
629 public DiffScmResult diff( ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion,
630 ScmVersion endVersion )
631 throws ScmException
632 {
633 return getDiffScmResult();
634 }
635
636
637
638
639 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate,
640 String datePattern, boolean runChangelog )
641 throws ScmException
642 {
643 return getUpdateScmResult();
644 }
645
646
647
648
649 public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet )
650 throws ScmException
651 {
652 return getEditScmResult();
653 }
654
655
656
657
658 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String tag )
659 throws ScmException
660 {
661 return getExportScmResult();
662 }
663
664
665
666
667 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String tag, String outputDirectory )
668 throws ScmException
669 {
670 return getExportScmResult();
671 }
672
673
674
675
676 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet )
677 throws ScmException
678 {
679 return getExportScmResult();
680 }
681
682
683
684
685 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
686 throws ScmException
687 {
688 return getExportScmResult();
689 }
690
691
692
693
694 public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
695 String outputDirectory )
696 throws ScmException
697 {
698 return getExportScmResult();
699 }
700
701
702
703
704 public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, String tag )
705 throws ScmException
706 {
707 return getListScmResult();
708 }
709
710
711
712
713 public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version )
714 throws ScmException
715 {
716 return getListScmResult();
717 }
718
719
720
721
722 public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message )
723 throws ScmException
724 {
725 return getRemoveScmResult();
726 }
727
728
729
730
731 public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
732 throws ScmException
733 {
734 return getStatusScmResult();
735 }
736
737
738
739
740 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tag )
741 throws ScmException
742 {
743 return getTagScmResult();
744 }
745
746
747
748
749 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tag, String message )
750 throws ScmException
751 {
752 return getTagScmResult();
753 }
754
755 public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName,
756 ScmTagParameters scmTagParameters )
757 throws ScmException
758 {
759 return getTagScmResult();
760 }
761
762 public UntagScmResult untag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
763 throws ScmException
764 {
765 return getUntagScmResult();
766 }
767
768
769
770
771 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag )
772 throws ScmException
773 {
774 return getUpdateScmResult();
775 }
776
777
778
779
780 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, boolean runChangelog )
781 throws ScmException
782 {
783 return getUpdateScmResult();
784 }
785
786
787
788
789 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, String datePattern )
790 throws ScmException
791 {
792 return getUpdateScmResult();
793 }
794
795
796
797
798 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate )
799 throws ScmException
800 {
801 return getUpdateScmResult();
802 }
803
804
805
806
807 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate,
808 String datePattern )
809 throws ScmException
810 {
811 return getUpdateScmResult();
812 }
813
814
815
816
817 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet )
818 throws ScmException
819 {
820 return getUpdateScmResult();
821 }
822
823
824
825
826 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
827 throws ScmException
828 {
829 return getUpdateScmResult();
830 }
831
832
833
834
835 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, boolean runChangelog )
836 throws ScmException
837 {
838 return getUpdateScmResult();
839 }
840
841
842
843
844 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
845 boolean runChangelog )
846 throws ScmException
847 {
848 return getUpdateScmResult();
849 }
850
851
852
853
854 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
855 String datePattern )
856 throws ScmException
857 {
858 return getUpdateScmResult();
859 }
860
861
862
863
864 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate )
865 throws ScmException
866 {
867 return getUpdateScmResult();
868 }
869
870
871
872
873 public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate,
874 String datePattern )
875 throws ScmException
876 {
877 return getUpdateScmResult();
878 }
879
880
881
882
883 public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet )
884 throws ScmException
885 {
886 return getUnEditScmResult();
887 }
888
889
890
891
892 public BlameScmResult blame( ScmRepository repository, ScmFileSet fileSet, String filename )
893 throws ScmException
894 {
895 return getBlameScmResult();
896 }
897
898 public BlameScmResult blame( BlameScmRequest blameScmRequest )
899 throws ScmException
900 {
901 return getBlameScmResult();
902 }
903
904
905
906
907 public MkdirScmResult mkdir( ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal )
908 throws ScmException
909 {
910 return getMkdirScmResult();
911 }
912
913 public InfoScmResult info( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
914 throws ScmException
915 {
916 return new InfoScmResult( "", "", "", true );
917 }
918
919 public RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
920 CommandParameters parameters )
921 throws ScmException
922 {
923 return new RemoteInfoScmResult( "", null, null );
924 }
925 }