KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > sos > SOSLabel


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.taskdefs.optional.sos;
19
20 import org.apache.tools.ant.BuildException;
21 import org.apache.tools.ant.types.Commandline;
22
23 /**
24  * Labels Visual SourceSafe files via a SourceOffSite server.
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 JavaDoc 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 JavaDoc 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 JavaDoc 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 }
92
Popular Tags