1 package org.apache.maven.scm.command;
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.ScmException;
24 import org.apache.maven.scm.ScmFileSet;
25 import org.apache.maven.scm.ScmResult;
26 import org.apache.maven.scm.log.ScmLogger;
27 import org.apache.maven.scm.provider.ScmProviderRepository;
28
29
30
31
32
33
34 public abstract class AbstractCommand
35 implements Command
36 {
37 private ScmLogger logger;
38
39 protected abstract ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
40 CommandParameters parameters )
41 throws ScmException;
42
43 public final ScmResult execute( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
44 throws ScmException
45 {
46 if ( repository == null )
47 {
48 throw new NullPointerException( "repository cannot be null" );
49 }
50
51 if ( fileSet == null )
52 {
53 throw new NullPointerException( "fileSet cannot be null" );
54 }
55
56 try
57 {
58 return executeCommand( repository, fileSet, parameters );
59 }
60 catch ( Exception ex )
61 {
62 throw new ScmException( "Exception while executing SCM command.", ex );
63 }
64 }
65
66
67
68
69 public final ScmLogger getLogger()
70 {
71 return logger;
72 }
73
74
75
76
77 public final void setLogger( ScmLogger logger )
78 {
79 this.logger = logger;
80 }
81 }