1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.scm.command;
20
21 import org.apache.maven.scm.CommandParameters;
22 import org.apache.maven.scm.ScmException;
23 import org.apache.maven.scm.ScmFileSet;
24 import org.apache.maven.scm.ScmResult;
25 import org.apache.maven.scm.provider.ScmProviderRepository;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29
30
31
32
33 public abstract class AbstractCommand implements Command {
34 protected Logger logger = LoggerFactory.getLogger(getClass());
35
36 protected abstract ScmResult executeCommand(
37 ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException;
38
39
40
41
42 public final ScmResult execute(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
43 throws ScmException {
44 if (repository == null) {
45 throw new NullPointerException("repository cannot be null");
46 }
47
48 if (fileSet == null) {
49 throw new NullPointerException("fileSet cannot be null");
50 }
51
52 try {
53 return executeCommand(repository, fileSet, parameters);
54 } catch (Exception ex) {
55 throw new ScmException("Exception while executing SCM command.", ex);
56 }
57 }
58 }