Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 200   Methods: 3
NCLOC: 27   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SOSCheckout.java 0% 0% 0% 0%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 package org.apache.tools.ant.taskdefs.optional.sos;
 55   
 
 56   
 import org.apache.tools.ant.BuildException;
 57   
 import org.apache.tools.ant.types.Commandline;
 58   
 
 59   
 /**
 60   
  * Retrieves and locks files in Visual SourceSafe via a SourceOffSite server.
 61   
  *
 62   
  * <p>
 63   
  * The following attributes are interpretted:
 64   
  * <table border="1">
 65   
  *   <tr>
 66   
  *     <th>Attribute</th>
 67   
  *     <th>Values</th>
 68   
  *     <th>Required</th>
 69   
  *   </tr>
 70   
  *   <tr>
 71   
  *     <td>soscmddir</td>
 72   
  *     <td>Directory which contains soscmd(.exe) <br>
 73   
  *     soscmd(.exe) must be in the path if this is not specified</td>
 74   
  *     <td>No</td>
 75   
  *   </tr>
 76   
  *   <tr>
 77   
  *      <td>vssserverpath</td>
 78   
  *      <td>path to the srcsafe.ini  - eg. \\server\vss\srcsafe.ini</td>
 79   
  *      <td>Yes</td>
 80   
  *   </tr>
 81   
  *   <tr>
 82   
  *      <td>sosserverpath</td>
 83   
  *      <td>address and port of the SOS server  - eg. 192.168.0.1:8888</td>
 84   
  *      <td>Yes</td>
 85   
  *   </tr>
 86   
  *   <tr>
 87   
  *      <td>projectpath</td>
 88   
  *      <td>SourceSafe project path</td>
 89   
  *      <td>Yes</td>
 90   
  *   </tr>
 91   
  *   <tr>
 92   
  *      <td>file</td>
 93   
  *      <td>Filename to act upon<br> If no file is specified then act upon the project</td>
 94   
  *      <td>No</td>
 95   
  *   </tr>
 96   
  *   <tr>
 97   
  *      <td>username</td>
 98   
  *      <td>SourceSafe username</td>
 99   
  *      <td>Yes</td>
 100   
  *   </tr>
 101   
  *   <tr>
 102   
  *      <td>password</td>
 103   
  *      <td>SourceSafe password</td>
 104   
  *      <td>No</td>
 105   
  *   </tr>
 106   
  *   <tr>
 107   
  *      <td>localpath</td>
 108   
  *      <td>Override the working directory and get to the specified path</td>
 109   
  *      <td>No</td>
 110   
  *   </tr>
 111   
  *   <tr>
 112   
  *      <td>soshome</td>
 113   
  *      <td>The path to the SourceOffSite home directory</td>
 114   
  *      <td>No</td>
 115   
  *   </tr>
 116   
  *   <tr>
 117   
  *      <td>nocompression</td>
 118   
  *      <td>true or false - disable compression</td>
 119   
  *      <td>No</td>
 120   
  *   </tr>
 121   
  *   <tr>
 122   
  *      <td>recursive</td>
 123   
  *      <td>true or false - Only works with the CheckOutProject command</td>
 124   
  *      <td>No</td>
 125   
  *   </tr>
 126   
  *   <tr>
 127   
  *      <td>nocache</td>
 128   
  *      <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td>
 129   
  *      <td>No</td>
 130   
  *   </tr>
 131   
  *   <tr>
 132   
  *      <td>verbose</td>
 133   
  *      <td>true or false - Status messages are displayed</td>
 134   
  *      <td>No</td>
 135   
  *   </tr>
 136   
  * </table>
 137   
  *
 138   
  * @author    Jesse Stockall
 139   
  */
 140   
 
 141   
 public class SOSCheckout extends SOS {
 142   
 
 143   
     /**
 144   
      * Set the Filename to act upon; optional.
 145   
      * If no file is specified then the tasks
 146   
      * act upon the project
 147   
      *
 148   
      * @param  filename  The new file value
 149   
      */
 150  0
     public final void setFile(String filename) {
 151  0
         super.setInternalFilename(filename);
 152   
     }
 153   
 
 154   
     /**
 155   
      * Flag to recursively apply the action; optional, default false
 156   
      *
 157   
      * @param  recursive  True for recursive operation.
 158   
      */
 159  0
     public void setRecursive(boolean recursive) {
 160  0
         super.setInternalRecursive(recursive);
 161   
     }
 162   
 
 163   
     /**
 164   
      * Build the command line <br>
 165   
      *
 166   
      * CheckOutFile required parameters: -server -name -password -database -project -file<br>
 167   
      * CheckOutFile optional parameters: -workdir -verbose -nocache -nocompression -soshome<br>
 168   
      *
 169   
      * CheckOutProject required parameters: -server -name -password -database -project<br>
 170   
      * CheckOutProject optional parameters:-workdir -recursive -verbose -nocache
 171   
      * -nocompression -soshome<br>
 172   
      *
 173   
      * @return    Commandline the generated command to be executed
 174   
      */
 175  0
     protected Commandline buildCmdLine() {
 176  0
         commandLine = new Commandline();
 177   
 
 178   
         // If we find a "file" attribute then act on a file otherwise act on a project
 179  0
         if (getFilename() != null) {
 180   
             // add -command CheckOutFile to the commandline
 181  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
 182  0
             commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE);
 183   
             // add -file xxxxx to the commandline
 184  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
 185  0
             commandLine.createArgument().setValue(getFilename());
 186   
         } else {
 187   
             // add -command CheckOutProject to the commandline
 188  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
 189  0
             commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT);
 190   
             // look for a recursive option
 191  0
             commandLine.createArgument().setValue(getRecursive());
 192   
         }
 193   
 
 194  0
         getRequiredAttributes();
 195  0
         getOptionalAttributes();
 196   
 
 197  0
         return commandLine;
 198   
     }
 199   
 }
 200