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
34 public abstract class AbstractCommand implements Command {
35 protected Logger logger = LoggerFactory.getLogger(getClass());
36
37 protected abstract ScmResult executeCommand(
38 ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException;
39
40
41 public final ScmResult execute(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
42 throws ScmException {
43 if (repository == null) {
44 throw new NullPointerException("repository cannot be null");
45 }
46
47 if (fileSet == null) {
48 throw new NullPointerException("fileSet cannot be null");
49 }
50
51 try {
52 return executeCommand(repository, fileSet, parameters);
53 } catch (Exception ex) {
54 throw new ScmException("Exception while executing SCM command.", ex);
55 }
56 }
57 }