Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 195   Methods: 9
NCLOC: 58   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CCMReconfigure.java 0% 0% 0% 0%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2001-2002 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   
 
 55   
 package org.apache.tools.ant.taskdefs.optional.ccm;
 56   
 
 57   
 
 58   
 import org.apache.tools.ant.BuildException;
 59   
 import org.apache.tools.ant.Project;
 60   
 import org.apache.tools.ant.types.Commandline;
 61   
 
 62   
 
 63   
 /**
 64   
  * Task allows to reconfigure a project, recurcively or not
 65   
  * @author Benoit Moussaud benoit.moussaud@criltelecom.com
 66   
  */
 67   
 public class CCMReconfigure extends Continuus {
 68   
 
 69   
     private String project = null;
 70   
     private boolean recurse = false;
 71   
     private boolean verbose = false;
 72   
 
 73  0
     public CCMReconfigure() {
 74  0
         super();
 75  0
         setCcmAction(COMMAND_RECONFIGURE);
 76   
     }
 77   
 
 78   
 
 79   
     /**
 80   
      * Executes the task.
 81   
      * <p>
 82   
      * Builds a command line to execute ccm and then calls Exec's run method
 83   
      * to execute the command line.
 84   
      * </p>
 85   
      */
 86  0
     public void execute() throws BuildException {
 87  0
         Commandline commandLine = new Commandline();
 88  0
         int result = 0;
 89   
 
 90   
         // build the command line from what we got the format
 91   
         // as specified in the CCM.EXE help
 92  0
         commandLine.setExecutable(getCcmCommand());
 93  0
         commandLine.createArgument().setValue(getCcmAction());
 94   
 
 95  0
         checkOptions(commandLine);
 96   
 
 97  0
         result = run(commandLine);
 98  0
         if (result != 0) {
 99  0
             String msg = "Failed executing: " + commandLine.toString();
 100  0
             throw new BuildException(msg, getLocation());
 101   
         }
 102   
     }
 103   
 
 104   
 
 105   
     /**
 106   
      * Check the command line options.
 107   
      */
 108  0
     private void checkOptions(Commandline cmd) {
 109   
 
 110  0
         if (isRecurse() == true) {
 111  0
             cmd.createArgument().setValue(FLAG_RECURSE);
 112   
         } // end of if ()
 113   
 
 114  0
         if (isVerbose() == true) {
 115  0
             cmd.createArgument().setValue(FLAG_VERBOSE);
 116   
         } // end of if ()
 117   
 
 118  0
         if (getCcmProject() != null) {
 119  0
             cmd.createArgument().setValue(FLAG_PROJECT);
 120  0
             cmd.createArgument().setValue(getCcmProject());
 121   
         }
 122   
 
 123   
     }
 124   
 
 125   
     /**
 126   
      * Get the value of project.
 127   
      * @return value of project.
 128   
      */
 129  0
     public String getCcmProject() {
 130  0
         return project;
 131   
     }
 132   
 
 133   
     /**
 134   
      * Sets the ccm project on which the operation is applied.
 135   
      * @param v  Value to assign to project.
 136   
      */
 137  0
     public void setCcmProject(String v) {
 138  0
         this.project = v;
 139   
     }
 140   
 
 141   
 
 142   
     /**
 143   
      * Get the value of recurse.
 144   
      * @return value of recurse.
 145   
      */
 146  0
     public boolean isRecurse() {
 147  0
         return recurse;
 148   
     }
 149   
 
 150   
     /**
 151   
      * If true, recurse on subproject (default false).
 152   
      *
 153   
      * @param v  Value to assign to recurse.
 154   
      */
 155  0
     public void setRecurse(boolean v) {
 156  0
         this.recurse = v;
 157   
     }
 158   
 
 159   
 
 160   
     /**
 161   
      * Get the value of verbose.
 162   
      * @return value of verbose.
 163   
      */
 164  0
     public boolean isVerbose() {
 165  0
         return verbose;
 166   
     }
 167   
 
 168   
     /**
 169   
      * If true, do a verbose reconfigure operation (default false).
 170   
      * @param v  Value to assign to verbose.
 171   
      */
 172  0
     public void setVerbose(boolean v) {
 173  0
         this.verbose = v;
 174   
     }
 175   
 
 176   
 
 177   
     /**
 178   
      * /recurse --
 179   
      */
 180   
     public static final String FLAG_RECURSE = "/recurse";
 181   
 
 182   
     /**
 183   
      * /recurse --
 184   
      */
 185   
     public static final String FLAG_VERBOSE = "/verbose";
 186   
 
 187   
 
 188   
     /**
 189   
      *  /project flag -- target project
 190   
      */
 191   
     public static final String FLAG_PROJECT = "/project";
 192   
 
 193   
 }
 194   
 
 195