[14627] | 1 | /*
|
---|
| 2 | * Copyright 2002-2004 The Apache Software Foundation
|
---|
| 3 | *
|
---|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 5 | * you may not use this file except in compliance with the License.
|
---|
| 6 | * You may obtain a copy of the License at
|
---|
| 7 | *
|
---|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 9 | *
|
---|
| 10 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 13 | * See the License for the specific language governing permissions and
|
---|
| 14 | * limitations under the License.
|
---|
| 15 | *
|
---|
| 16 | */
|
---|
| 17 | package org.apache.tools.ant.taskdefs.optional.sos;
|
---|
| 18 |
|
---|
| 19 | import org.apache.tools.ant.types.Commandline;
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * Commits and unlocks files in Visual SourceSafe via a SourceOffSite server.
|
---|
| 23 | *
|
---|
| 24 | *
|
---|
| 25 | * @ant.task name="soscheckin" category="scm"
|
---|
| 26 | */
|
---|
| 27 | public class SOSCheckin 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 | * The comment to apply to all files being labelled.
|
---|
| 51 | *
|
---|
| 52 | * @param comment The new comment value
|
---|
| 53 | */
|
---|
| 54 | public void setComment(String comment) {
|
---|
| 55 | super.setInternalComment(comment);
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | /**
|
---|
| 59 | * Build the command line. <p>
|
---|
| 60 | *
|
---|
| 61 | * CheckInFile required parameters: -server -name -password -database -project
|
---|
| 62 | * -file<br>
|
---|
| 63 | * CheckInFile optional parameters: -workdir -log -verbose -nocache -nocompression
|
---|
| 64 | * -soshome<br>
|
---|
| 65 | * CheckInProject required parameters: -server -name -password -database
|
---|
| 66 | * -project<br>
|
---|
| 67 | * CheckInProject optional parameters: workdir -recursive -log -verbose
|
---|
| 68 | * -nocache -nocompression -soshome<br>
|
---|
| 69 | *
|
---|
| 70 | * @return Commandline the generated command to be executed
|
---|
| 71 | */
|
---|
| 72 | protected Commandline buildCmdLine() {
|
---|
| 73 | commandLine = new Commandline();
|
---|
| 74 |
|
---|
| 75 | // If we find a "file" attribute then act on a file otherwise act on a project
|
---|
| 76 | if (getFilename() != null) {
|
---|
| 77 | // add -command CheckInFile to the commandline
|
---|
| 78 | commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
|
---|
| 79 | commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE);
|
---|
| 80 | // add -file xxxxx to the commandline
|
---|
| 81 | commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
|
---|
| 82 | commandLine.createArgument().setValue(getFilename());
|
---|
| 83 | } else {
|
---|
| 84 | // add -command CheckInProject to the commandline
|
---|
| 85 | commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
|
---|
| 86 | commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT);
|
---|
| 87 | // look for a recursive option
|
---|
| 88 | commandLine.createArgument().setValue(getRecursive());
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | getRequiredAttributes();
|
---|
| 92 | getOptionalAttributes();
|
---|
| 93 |
|
---|
| 94 | // Look for a comment
|
---|
| 95 | if (getComment() != null) {
|
---|
| 96 | commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT);
|
---|
| 97 | commandLine.createArgument().setValue(getComment());
|
---|
| 98 | }
|
---|
| 99 | return commandLine;
|
---|
| 100 | }
|
---|
| 101 | }
|
---|