Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 241   Methods: 5
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SOSGet.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 a read-only copy of the specified project or file
 61   
  * from Visual SourceSafe via a SourceOffSite server.
 62   
  * <p>
 63   
  * The following attributes are interpretted:
 64   
  * <table border="1">
 65   
  *    <tbody>
 66   
  *      <tr>
 67   
  *         <th>Attribute</th>
 68   
  *         <th>Values</th>
 69   
  *         <th>Required</th>
 70   
  *       </tr>
 71   
  *       <tr>
 72   
  *         <td>soscmddir</td>
 73   
  *         <td>Directory which contains soscmd(.exe) <br>
 74   
  *         soscmd(.exe) must be in the path if this is not specified</td>
 75   
  *         <td>No</td>
 76   
  *       </tr>
 77   
  *       <tr>
 78   
  *          <td>vssserverpath</td>
 79   
  *          <td>path to the srcsafe.ini  - eg. \\server\vss\srcsafe.ini</td>
 80   
  *          <td>Yes</td>
 81   
  *       </tr>
 82   
  *       <tr>
 83   
  *          <td>sosserverpath</td>
 84   
  *          <td>address and port of the SOS server  - eg. 192.168.0.1:8888</td>
 85   
  *          <td>Yes</td>
 86   
  *       </tr>
 87   
  *       <tr>
 88   
  *          <td>projectpath</td>
 89   
  *          <td>SourceSafe project path</td>
 90   
  *          <td>Yes</td>
 91   
  *       </tr>
 92   
  *       <tr>
 93   
  *          <td>file</td>
 94   
  *          <td>Filename to act upon<br>
 95   
  *              If no file is specified then act upon the project</td>
 96   
  *          <td>No</td>
 97   
  *       </tr>
 98   
  *       <tr>
 99   
  *          <td>username</td>
 100   
  *          <td>SourceSafe username</td>
 101   
  *          <td>Yes</td>
 102   
  *       </tr>
 103   
  *       <tr>
 104   
  *          <td>password</td>
 105   
  *          <td>SourceSafe password</td>
 106   
  *          <td>No</td>
 107   
  *       </tr>
 108   
  *       <tr>
 109   
  *          <td>localpath</td>
 110   
  *          <td>Override the working directory and get to the specified path</td>
 111   
  *          <td>No</td>
 112   
  *       </tr>
 113   
  *       <tr>
 114   
  *          <td>soshome</td>
 115   
  *          <td>The path to the SourceOffSite home directory</td>
 116   
  *          <td>No</td>
 117   
  *       </tr>
 118   
  *       <tr>
 119   
  *          <td>nocompression</td>
 120   
  *          <td>true or false - disable compression</td>
 121   
  *          <td>No</td>
 122   
  *       </tr>
 123   
  *       <tr>
 124   
  *          <td>recursive</td>
 125   
  *          <td>true or false - Only works with the GetProject command</td>
 126   
  *          <td>No</td>
 127   
  *       </tr>
 128   
  *       <tr>
 129   
  *          <td>version</td>
 130   
  *          <td>a version number to get - Only works with the GetFile command</td>
 131   
  *          <td>No</td>
 132   
  *       </tr>
 133   
  *       <tr>
 134   
  *          <td>label</td>
 135   
  *          <td>a label version to get - Only works with the GetProject command</td>
 136   
  *          <td>No</td>
 137   
  *       </tr>
 138   
  *       <tr>
 139   
  *          <td>nocache</td>
 140   
  *          <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td>
 141   
  *          <td>No</td>
 142   
  *       </tr>
 143   
  *       <tr>
 144   
  *          <td>verbose</td>
 145   
  *         <td>true or false - Status messages are displayed</td>
 146   
  *        <td>No</td>
 147   
  *      </tr>
 148   
  *
 149   
  * @author    Jesse Stockall
 150   
  */
 151   
 
 152   
 public class SOSGet extends SOS {
 153   
 
 154   
     /**
 155   
      * Set the Filename to act upon; optional.
 156   
      * If no file is specified then the tasks
 157   
      * act upon the project
 158   
      *
 159   
      * @param  filename  The new file value
 160   
      */
 161  0
     public final void setFile(String filename) {
 162  0
         super.setInternalFilename(filename);
 163   
     }
 164   
 
 165   
     /**
 166   
      * Flag to recursively apply the action; optional, default false
 167   
      *
 168   
      * @param  recursive  True for recursive operation.
 169   
      */
 170  0
     public void setRecursive(boolean recursive) {
 171  0
         super.setInternalRecursive(recursive);
 172   
     }
 173   
 
 174   
     /**
 175   
      * Set the version number to get -
 176   
      * only works with SOSGet on a file; optional.
 177   
      *
 178   
      * @param  version  The new version value
 179   
      */
 180  0
     public void setVersion(String version) {
 181  0
         super.setInternalVersion(version);
 182   
     }
 183   
 
 184   
     /**
 185   
      * Set the labeled version to operate on in SourceSafe
 186   
      *
 187   
      * @param  label  The new label value
 188   
      */
 189  0
     public void setLabel(String label) {
 190  0
         super.setInternalLabel(label);
 191   
     }
 192   
 
 193   
     /**
 194   
      * Build the command line <br>
 195   
      *
 196   
      * GetFile required parameters: -server -name -password -database -project -file<br>
 197   
      * GetFile optional parameters: -workdir -revision -verbose -nocache -nocompression -soshome<br>
 198   
      *
 199   
      * GetProject required parameters: -server -name -password -database -project<br>
 200   
      * GetProject optional parameters: -label -workdir -recursive -verbose -nocache
 201   
      * -nocompression -soshome<br>
 202   
      *
 203   
      * @return    Commandline the generated command to be executed
 204   
      */
 205  0
     protected Commandline buildCmdLine() {
 206  0
         commandLine = new Commandline();
 207   
 
 208   
         // If we find a "file" attribute then act on a file otherwise act on a project
 209  0
         if (getFilename() != null) {
 210   
             // add -command GetFile to the commandline
 211  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
 212  0
             commandLine.createArgument().setValue(SOSCmd.COMMAND_GET_FILE);
 213   
             // add -file xxxxx to the commandline
 214  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_FILE);
 215  0
             commandLine.createArgument().setValue(getFilename());
 216   
             // look for a version attribute
 217  0
             if (getVersion() != null) {
 218   
                 //add -revision xxxxx to the commandline
 219  0
                 commandLine.createArgument().setValue(SOSCmd.FLAG_VERSION);
 220  0
                 commandLine.createArgument().setValue(getVersion());
 221   
             }
 222   
         } else {
 223   
             // add -command GetProject to the commandline
 224  0
             commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND);
 225  0
             commandLine.createArgument().setValue(SOSCmd.COMMAND_GET_PROJECT);
 226   
             // look for a recursive option
 227  0
             commandLine.createArgument().setValue(getRecursive());
 228   
             // look for a label option
 229  0
             if (getLabel() != null) {
 230  0
                 commandLine.createArgument().setValue(SOSCmd.FLAG_LABEL);
 231  0
                 commandLine.createArgument().setValue(getLabel());
 232   
             }
 233   
         }
 234   
 
 235  0
         getRequiredAttributes();
 236  0
         getOptionalAttributes();
 237   
 
 238  0
         return commandLine;
 239   
     }
 240   
 }
 241