KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > vss > MSVSSLABEL


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
19 package org.apache.tools.ant.taskdefs.optional.vss;
20
21 import org.apache.tools.ant.BuildException;
22 import org.apache.tools.ant.types.Commandline;
23
24 /**
25  * Performs Label commands to Microsoft Visual SourceSafe.
26  *
27  * @ant.task name="vsslabel" category="scm"
28  */

29 public class MSVSSLABEL extends MSVSS {
30
31     /**
32      * Builds a command line to execute ss.
33      * @return The constructed commandline.
34      */

35     Commandline buildCmdLine() {
36         Commandline commandLine = new Commandline();
37
38         // first off, make sure that we've got a command and a vssdir and a label ...
39
if (getVsspath() == null) {
40             throw new BuildException("vsspath attribute must be set!", getLocation());
41         }
42
43         String JavaDoc label = getLabel();
44         if (label.equals("")) {
45             String JavaDoc msg = "label attribute must be set!";
46             throw new BuildException(msg, getLocation());
47         }
48
49         // build the command line from what we got the format is
50
// ss Label VSS items [-C] [-H] [-I-] [-Llabel] [-N] [-O] [-V] [-Y] [-?]
51
// as specified in the SS.EXE help
52
commandLine.setExecutable(getSSCommand());
53         commandLine.createArgument().setValue(COMMAND_LABEL);
54
55         // VSS items
56
commandLine.createArgument().setValue(getVsspath());
57         // -C
58
commandLine.createArgument().setValue(getComment());
59         // -I- or -I-Y or -I-N
60
commandLine.createArgument().setValue(getAutoresponse());
61         // -L Specify the new label on the command line (instead of being prompted)
62
commandLine.createArgument().setValue(label);
63         // -V Label an existing file or project version
64
commandLine.createArgument().setValue(getVersion());
65         // -Y
66
commandLine.createArgument().setValue(getLogin());
67
68         return commandLine;
69     }
70
71     /**
72      * Label to apply in SourceSafe.
73      *
74      * @param label The label to apply.
75      *
76      * @ant.attribute group="required"
77      */

78     public void setLabel(String JavaDoc label) {
79         super.setInternalLabel(label);
80     }
81
82     /**
83      * Version to label.
84      *
85      * @param version The version to label.
86      */

87     public void setVersion(String JavaDoc version) {
88         super.setInternalVersion(version);
89     }
90
91     /**
92      * Comment to apply to files labeled in SourceSafe.
93      *
94      * @param comment The comment to apply in SourceSafe
95      */

96     public void setComment(String JavaDoc comment) {
97         super.setInternalComment(comment);
98     }
99
100     /**
101      * Autoresponce behaviour. Valid options are Y and N.
102      *
103      * @param response The auto response value.
104      */

105     public void setAutoresponse(String JavaDoc response) {
106         super.setInternalAutoResponse(response);
107     }
108 }
109
Popular Tags