01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.types.Commandline;
21:
22: /**
23: * Retrieves and locks files in Visual SourceSafe via a SourceOffSite server.
24: *
25: * @ant.task name="soscheckout" category="scm"
26: */
27: public class SOSCheckout extends SOS {
28:
29: /**
30: * The filename to act upon.
31: * If no file is specified then the task
32: * acts upon the project.
33: *
34: * @param filename The new file value
35: */
36: public final void setFile(String filename) {
37: super .setInternalFilename(filename);
38: }
39:
40: /**
41: * Flag to recursively apply the action. Defaults to false.
42: *
43: * @param recursive True for recursive operation.
44: */
45: public void setRecursive(boolean recursive) {
46: super .setInternalRecursive(recursive);
47: }
48:
49: /**
50: * Build the command line <br>
51: *
52: * CheckOutFile required parameters: -server -name -password -database -project -file<br>
53: * CheckOutFile optional parameters: -workdir -verbose -nocache -nocompression -soshome<br>
54: *
55: * CheckOutProject required parameters: -server -name -password -database -project<br>
56: * CheckOutProject optional parameters:-workdir -recursive -verbose -nocache
57: * -nocompression -soshome<br>
58: *
59: * @return Commandline the generated command to be executed
60: */
61: protected Commandline buildCmdLine() {
62: commandLine = new Commandline();
63:
64: // If we find a "file" attribute then act on a file otherwise act on a project
65: if (getFilename() != null) {
66: // add -command CheckOutFile to the commandline
67: commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
68: commandLine.createArgument().setValue(
69: SOSCmd.COMMAND_CHECKOUT_FILE);
70: // add -file xxxxx to the commandline
71: commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
72: commandLine.createArgument().setValue(getFilename());
73: } else {
74: // add -command CheckOutProject to the commandline
75: commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
76: commandLine.createArgument().setValue(
77: SOSCmd.COMMAND_CHECKOUT_PROJECT);
78: // look for a recursive option
79: commandLine.createArgument().setValue(getRecursive());
80: }
81:
82: getRequiredAttributes();
83: getOptionalAttributes();
84:
85: return commandLine;
86: }
87: }
|