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.vss;
  18. import org.apache.tools.ant.BuildException;
  19. import org.apache.tools.ant.types.Commandline;
  20. /**
  21. * Creates a new project in Microsoft Visual SourceSafe.
  22. *
  23. * @ant.task name="vsscreate" category="scm"
  24. */
  25. public class MSVSSCREATE extends MSVSS {
  26. /**
  27. * Builds a command line to execute ss.
  28. * @return The constructed commandline.
  29. */
  30. Commandline buildCmdLine() {
  31. Commandline commandLine = new Commandline();
  32. // first off, make sure that we've got a command and a vssdir...
  33. if (getVsspath() == null) {
  34. String msg = "vsspath attribute must be set!";
  35. throw new BuildException(msg, getLocation());
  36. }
  37. // build the command line from what we got
  38. // the format is:
  39. // ss Create VSS items [-C] [-H] [-I-] [-N] [-O] [-S] [-Y] [-?]
  40. // as specified in the SS.EXE help
  41. commandLine.setExecutable(getSSCommand());
  42. commandLine.createArgument().setValue(COMMAND_CREATE);
  43. // VSS items
  44. commandLine.createArgument().setValue(getVsspath());
  45. // -C
  46. commandLine.createArgument().setValue(getComment());
  47. // -I- or -I-Y or -I-N
  48. commandLine.createArgument().setValue(getAutoresponse());
  49. // -O-
  50. commandLine.createArgument().setValue(getQuiet());
  51. // -Y
  52. commandLine.createArgument().setValue(getLogin());
  53. return commandLine;
  54. }
  55. /**
  56. * Comment to apply to the project created in SourceSafe.
  57. *
  58. * @param comment The comment to apply in SourceSafe
  59. */
  60. public void setComment(String comment) {
  61. super.setInternalComment(comment);
  62. }
  63. /**
  64. * Enable quiet mode. Defaults to false.
  65. *
  66. * @param quiet The boolean value for quiet.
  67. */
  68. public final void setQuiet (boolean quiet) {
  69. super.setInternalQuiet(quiet);
  70. }
  71. /**
  72. * Autoresponce behaviour. Valid options are Y and N.
  73. *
  74. * @param response The auto response value.
  75. */
  76. public void setAutoresponse(String response) {
  77. super.setInternalAutoResponse(response);
  78. }
  79. }