KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.apache.tools.ant.types.Path;
24
25 /**
26  * Performs CheckOut commands to Microsoft Visual SourceSafe.
27  *
28  * @ant.task name="vsscheckout" category="scm"
29  * @ant.attribute.group name="vdl" description="Only one of version, date or label"
30  */

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

37     protected Commandline buildCmdLine() {
38         Commandline commandLine = new Commandline();
39
40         // first off, make sure that we've got a command and a vssdir ...
41
if (getVsspath() == null) {
42             String JavaDoc msg = "vsspath attribute must be set!";
43             throw new BuildException(msg, getLocation());
44         }
45
46         // build the command line from what we got the format is
47
// ss Checkout VSS items [-G] [-C] [-H] [-I-] [-N] [-O] [-R] [-V] [-Y] [-?]
48
// as specified in the SS.EXE help
49
commandLine.setExecutable(getSSCommand());
50         commandLine.createArgument().setValue(COMMAND_CHECKOUT);
51
52         // VSS items
53
commandLine.createArgument().setValue(getVsspath());
54         // -GL
55
commandLine.createArgument().setValue(getLocalpath());
56         // -I- or -I-Y or -I-N
57
commandLine.createArgument().setValue(getAutoresponse());
58         // -R
59
commandLine.createArgument().setValue(getRecursive());
60         // -V
61
commandLine.createArgument().setValue(getVersionDateLabel());
62         // -Y
63
commandLine.createArgument().setValue(getLogin());
64         // -G
65
commandLine.createArgument().setValue(getFileTimeStamp());
66         // -GWS or -GWR
67
commandLine.createArgument().setValue(getWritableFiles());
68         // -G-
69
commandLine.createArgument().setValue(getGetLocalCopy());
70
71         return commandLine;
72     }
73
74     /**
75      * Override the project working directory.
76      *
77      * @param localPath The path on disk.
78      */

79     public void setLocalpath(Path localPath) {
80         super.setInternalLocalPath(localPath.toString());
81     }
82
83     /**
84      * Check-out files recursively. Defaults to false.
85      *
86      * @param recursive The boolean value for recursive.
87      */

88     public void setRecursive(boolean recursive) {
89         super.setInternalRecursive(recursive);
90     }
91
92     /**
93      * Version to check-out.
94      *
95      * @param version The version to check-out.
96      *
97      * @ant.attribute group="vdl"
98      */

99     public void setVersion(String JavaDoc version) {
100         super.setInternalVersion(version);
101     }
102
103     /**
104      * Date to check-out.
105      *
106      * @param date The date to check-out.
107      *
108      * @ant.attribute group="vdl"
109      */

110     public void setDate(String JavaDoc date) {
111         super.setInternalDate(date);
112     }
113
114     /**
115      * Label to check-out.
116      *
117      * @param label The label to check-out.
118      *
119      * @ant.attribute group="vdl"
120      */

121     public void setLabel(String JavaDoc label) {
122         super.setInternalLabel(label);
123     }
124
125     /**
126      * Autoresponce behaviour. Valid options are Y and N.
127      *
128      * @param response The auto response value.
129      */

130     public void setAutoresponse(String JavaDoc response) {
131         super.setInternalAutoResponse(response);
132     }
133
134     /**
135      * Date and time stamp given to the local copy. Defaults to <code>current</code>.
136      *
137      * @param timestamp The file time stamping behaviour.
138      */

139     public void setFileTimeStamp(CurrentModUpdated timestamp) {
140         super.setInternalFileTimeStamp(timestamp);
141     }
142
143     /**
144      * Action taken when local files are writable. Defaults to <code>fail</code>.
145      * <p>
146      * Due to ss.exe returning with an exit code of '100' for both errors and when
147      * a file has been skipped, <code>failonerror</code> is set to false when using
148      * the <code>skip</code> option.
149      * </p>
150      *
151      * @param files The writable files behaviour
152      */

153     public void setWritableFiles(WritableFiles files) {
154         super.setInternalWritableFiles(files);
155     }
156
157     /**
158      * Retrieve a local copy during a checkout. Defaults to true.
159      *
160      * @param get The get local copy behaviour
161      */

162     public void setGetLocalCopy(boolean get) {
163         super.setInternalGetLocalCopy(get);
164     }
165 }
166
Popular Tags