1 | /*
|
---|
2 | * Copyright 2002-2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant.taskdefs.optional.sos;
|
---|
18 |
|
---|
19 | import org.apache.tools.ant.BuildException;
|
---|
20 | import org.apache.tools.ant.types.Commandline;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Labels Visual SourceSafe files via a SourceOffSite server.
|
---|
24 | *
|
---|
25 | *
|
---|
26 | * @ant.task name="soslabel" category="scm"
|
---|
27 | */
|
---|
28 | public class SOSLabel extends SOS {
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The version number to label.
|
---|
32 | *
|
---|
33 | * @param version The new version value
|
---|
34 | */
|
---|
35 | public void setVersion(String version) {
|
---|
36 | super.setInternalVersion(version);
|
---|
37 | }
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * The label to apply the the files in SourceSafe.
|
---|
41 | *
|
---|
42 | * @param label The new label value
|
---|
43 | *
|
---|
44 | * @ant.attribute group="required"
|
---|
45 | */
|
---|
46 | public void setLabel(String label) {
|
---|
47 | super.setInternalLabel(label);
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * The comment to apply to all files being labelled.
|
---|
52 | *
|
---|
53 | * @param comment The new comment value
|
---|
54 | */
|
---|
55 | public void setComment(String comment) {
|
---|
56 | super.setInternalComment(comment);
|
---|
57 | }
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Build the command line <br>
|
---|
61 | * AddLabel required parameters: -server -name -password -database -project -label<br>
|
---|
62 | * AddLabel optional parameters: -verbose -comment<br>
|
---|
63 | *
|
---|
64 | * @return Commandline the generated command to be executed
|
---|
65 | */
|
---|
66 | protected Commandline buildCmdLine() {
|
---|
67 | commandLine = new Commandline();
|
---|
68 |
|
---|
69 | // add -command AddLabel to the commandline
|
---|
70 | commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
|
---|
71 | commandLine.createArgument().setValue(SOSCmd.COMMAND_LABEL);
|
---|
72 |
|
---|
73 | getRequiredAttributes();
|
---|
74 |
|
---|
75 | // a label is required
|
---|
76 | if (getLabel() == null) {
|
---|
77 | throw new BuildException("label attribute must be set!", getLocation());
|
---|
78 | }
|
---|
79 | commandLine.createArgument().setValue(SOSCmd.FLAG_LABEL);
|
---|
80 | commandLine.createArgument().setValue(getLabel());
|
---|
81 |
|
---|
82 | // -verbose
|
---|
83 | commandLine.createArgument().setValue(getVerbose());
|
---|
84 | // Look for a comment
|
---|
85 | if (getComment() != null) {
|
---|
86 | commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT);
|
---|
87 | commandLine.createArgument().setValue(getComment());
|
---|
88 | }
|
---|
89 | return commandLine;
|
---|
90 | }
|
---|
91 | }
|
---|