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.tag;
20
21 import org.apache.maven.scm.CommandParameter;
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.ScmTagParameters;
27 import org.apache.maven.scm.command.AbstractCommand;
28 import org.apache.maven.scm.provider.ScmProviderRepository;
29
30
31
32
33
34
35 public abstract class AbstractTagCommand extends AbstractCommand {
36
37
38
39
40
41
42
43
44
45 protected ScmResult executeTagCommand(
46 ScmProviderRepository repository, ScmFileSet fileSet, String tagName, String message) throws ScmException {
47 return executeTagCommand(repository, fileSet, tagName, new ScmTagParameters(message));
48 }
49
50 protected abstract ScmResult executeTagCommand(
51 ScmProviderRepository repository, ScmFileSet fileSet, String tagName, ScmTagParameters scmTagParameters)
52 throws ScmException;
53
54
55 public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
56 throws ScmException {
57 String tagName = parameters.getString(CommandParameter.TAG_NAME);
58
59 ScmTagParameters scmTagParameters = parameters.getScmTagParameters(CommandParameter.SCM_TAG_PARAMETERS);
60
61 String message = parameters.getString(CommandParameter.MESSAGE, null);
62
63 if (message != null) {
64
65 scmTagParameters.setMessage(message);
66 }
67
68 if (scmTagParameters.getMessage() == null) {
69
70 scmTagParameters.setMessage("[maven-scm] copy for tag " + tagName);
71 }
72
73 return executeTagCommand(repository, fileSet, tagName, scmTagParameters);
74 }
75 }