KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Perform Get commands from Microsoft Visual SourceSafe.
27  *
28  * @ant.task name="vssget" category="scm"
29  * @ant.attribute.group name="vdl" description="Only one of version, date or label"
30  */

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

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

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

87     public final void setRecursive(boolean recursive) {
88         super.setInternalRecursive(recursive);
89     }
90
91     /**
92      * Enable quiet mode. Defaults to false.
93      *
94      * @param quiet The boolean value for quiet.
95      */

96     public final void setQuiet (boolean quiet) {
97         super.setInternalQuiet(quiet);
98     }
99
100     /**
101      * Unset the READ-ONLY flag on files retrieved from VSS. Defaults to false.
102      *
103      * @param writable The boolean value for writable.
104      */

105     public final void setWritable(boolean writable) {
106         super.setInternalWritable(writable);
107     }
108
109     /**
110      * Version to get.
111      *
112      * @param version The version to get.
113      *
114      * @ant.attribute group="vdl"
115      */

116     public void setVersion(String JavaDoc version) {
117         super.setInternalVersion(version);
118     }
119
120     /**
121      * Date to get.
122      *
123      * @param date The date to get.
124      *
125      * @ant.attribute group="vdl"
126      */

127     public void setDate(String JavaDoc date) {
128         super.setInternalDate(date);
129     }
130
131     /**
132      * Label to get.
133      *
134      * @param label The label to get.
135      *
136      * @ant.attribute group="vdl"
137      */

138     public void setLabel(String JavaDoc label) {
139         super.setInternalLabel(label);
140     }
141
142     /**
143      * Autoresponce behaviour. Valid options are Y and N.
144      *
145      * @param response The auto response value.
146      */

147     public void setAutoresponse(String JavaDoc response) {
148         super.setInternalAutoResponse(response);
149     }
150
151     /**
152      * Date and time stamp given to the local copy. Defaults to <code>current</code>.
153      *
154      * @param timestamp The file time stamping behaviour.
155      */

156     public void setFileTimeStamp(CurrentModUpdated timestamp) {
157         super.setInternalFileTimeStamp(timestamp);
158     }
159
160     /**
161      * Action taken when local files are writable. Defaults to <code>fail</code>.
162      * <p>
163      * Due to ss.exe returning with an exit code of '100' for both errors and when
164      * a file has been skipped, <code>failonerror</code> is set to false when using
165      * the <code>skip</code> option.
166      *
167      * @param files The action to take.
168      */

169     public void setWritableFiles(WritableFiles files) {
170         super.setInternalWritableFiles(files);
171     }
172 }
173
Popular Tags