KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Creates a new project in Microsoft Visual SourceSafe.
26  *
27  * @ant.task name="vsscreate" category="scm"
28  */

29 public class MSVSSCREATE 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...
39
if (getVsspath() == null) {
40             String JavaDoc msg = "vsspath attribute must be set!";
41             throw new BuildException(msg, getLocation());
42         }
43
44         // build the command line from what we got
45
// the format is:
46
// ss Create VSS items [-C] [-H] [-I-] [-N] [-O] [-S] [-Y] [-?]
47
// as specified in the SS.EXE help
48
commandLine.setExecutable(getSSCommand());
49         commandLine.createArgument().setValue(COMMAND_CREATE);
50
51         // VSS items
52
commandLine.createArgument().setValue(getVsspath());
53         // -C
54
commandLine.createArgument().setValue(getComment());
55         // -I- or -I-Y or -I-N
56
commandLine.createArgument().setValue(getAutoresponse());
57         // -O-
58
commandLine.createArgument().setValue(getQuiet());
59         // -Y
60
commandLine.createArgument().setValue(getLogin());
61
62         return commandLine;
63     }
64
65     /**
66      * Comment to apply to the project created in SourceSafe.
67      *
68      * @param comment The comment to apply in SourceSafe
69      */

70     public void setComment(String JavaDoc comment) {
71         super.setInternalComment(comment);
72     }
73
74     /**
75      * Enable quiet mode. Defaults to false.
76      *
77      * @param quiet The boolean value for quiet.
78      */

79     public final void setQuiet (boolean quiet) {
80         super.setInternalQuiet(quiet);
81     }
82
83     /**
84      * Autoresponce behaviour. Valid options are Y and N.
85      *
86      * @param response The auto response value.
87      */

88     public void setAutoresponse(String JavaDoc response) {
89         super.setInternalAutoResponse(response);
90     }
91 }
92
Popular Tags