Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 212   Methods: 12
NCLOC: 58   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
VAJExport.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.ide;
 56   
 
 57   
 
 58   
 import java.io.File;
 59   
 import org.apache.tools.ant.BuildException;
 60   
 import org.apache.tools.ant.types.PatternSet;
 61   
 
 62   
 /**
 63   
  * Export packages from the Visual Age for Java workspace.
 64   
  * The packages are specified similar to all other MatchingTasks.
 65   
  * Since the VA Workspace is not file based, this task is simulating
 66   
  * a directory hierarchy for the workspace:
 67   
  * The 'root' contains all project 'dir's, and the projects contain
 68   
  * their respective package 'dir's.
 69   
  * Example:
 70   
  * <blockquote>
 71   
  * &lt;vajexport destdir="C:/builddir/source">
 72   
  * &nbsp;&lt;include name="/MyVAProject/org/foo/subsystem1/**" />
 73   
  * &nbsp;&lt;exclude name="/MyVAProject/org/foo/subsystem1/test/**"/>
 74   
  * &lt;/vajexport>
 75   
  * </blockquote>
 76   
  * exports all packages in the project MyVAProject which start with
 77   
  * 'org.foo.subsystem1' except of these starting with
 78   
  * 'org.foo.subsystem1.test'.
 79   
  *
 80   
  * There are flags to choose which items to export:
 81   
  * exportSources:   export Java sources
 82   
  * exportResources: export project resources
 83   
  * exportClasses:   export class files
 84   
  * exportDebugInfo: export class files with debug info (use with exportClasses)
 85   
  * default is exporting Java files and resources.
 86   
  *
 87   
  * @author Wolf Siberski, TUI Infotec GmbH
 88   
  */
 89   
 
 90   
 public class VAJExport extends VAJTask {
 91   
     //set set... method comments for description
 92   
     protected File destDir;
 93   
     protected boolean exportSources = true;
 94   
     protected boolean exportResources = true;
 95   
     protected boolean exportClasses = false;
 96   
     protected boolean exportDebugInfo = false;
 97   
     protected boolean useDefaultExcludes = true;
 98   
     protected boolean overwrite = true;
 99   
 
 100   
     protected PatternSet patternSet = new PatternSet();
 101   
 
 102   
     /**
 103   
      * add a name entry on the exclude list
 104   
      */
 105  0
     public PatternSet.NameEntry createExclude() {
 106  0
         return patternSet.createExclude();
 107   
     }
 108   
 
 109   
     /**
 110   
      * add a name entry on the include list
 111   
      */
 112  0
     public PatternSet.NameEntry createInclude() {
 113  0
         return patternSet.createInclude();
 114   
     }
 115   
 
 116   
     /**
 117   
      * do the export
 118   
      */
 119  0
     public void execute() throws BuildException {
 120   
         // first off, make sure that we've got a destdir
 121  0
         if (destDir == null) {
 122  0
             throw new BuildException("destdir attribute must be set!");
 123   
         }
 124   
 
 125   
         // delegate the export to the VAJUtil object.
 126  0
         getUtil().exportPackages(destDir,
 127   
             patternSet.getIncludePatterns(getProject()),
 128   
             patternSet.getExcludePatterns(getProject()),
 129   
             exportClasses, exportDebugInfo,
 130   
             exportResources, exportSources,
 131   
             useDefaultExcludes, overwrite);
 132   
     }
 133   
 
 134   
     /**
 135   
      * Sets whether default exclusions should be used or not; default true.
 136   
      *
 137   
      * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions
 138   
      *                           should be used, "false"|"off"|"no" when they
 139   
      *                           shouldn't be used.
 140   
      */
 141  0
     public void setDefaultexcludes(boolean useDefaultExcludes) {
 142  0
         this.useDefaultExcludes = useDefaultExcludes;
 143   
     }
 144   
 
 145   
     /**
 146   
      * Set the destination directory into which the selected
 147   
      * items should be exported; required.
 148   
      */
 149  0
     public void setDestdir(File destDir) {
 150  0
         this.destDir = destDir;
 151   
     }
 152   
 
 153   
     /**
 154   
      * Sets the set of exclude patterns. Patterns may be separated by a comma
 155   
      * or a space. Currently only patterns denoting packages are
 156   
      * supported
 157   
      *
 158   
      * @param excludes the string containing the exclude patterns
 159   
      */
 160  0
     public void setExcludes(String excludes) {
 161  0
         patternSet.setExcludes(excludes);
 162   
     }
 163   
 
 164   
     /**
 165   
      * optional flag to export the class files; default false.
 166   
      */
 167  0
     public void setExportClasses(boolean doExport) {
 168  0
         exportClasses = doExport;
 169   
     }
 170   
 
 171   
     /**
 172   
      * optional flag to export the debug info; default false.
 173   
      * debug info
 174   
      */
 175  0
     public void setExportDebugInfo(boolean doExport) {
 176  0
         exportDebugInfo = doExport;
 177   
     }
 178   
 
 179   
     /**
 180   
      * optional flag to export the resource file; default true.
 181   
      */
 182  0
     public void setExportResources(boolean doExport) {
 183  0
         exportResources = doExport;
 184   
     }
 185   
 
 186   
     /**
 187   
      * optional flag to export the Java files; default true.
 188   
      */
 189  0
     public void setExportSources(boolean doExport) {
 190  0
         exportSources = doExport;
 191   
     }
 192   
 
 193   
     /**
 194   
      * Sets the set of include patterns. Patterns may be separated by a comma
 195   
      * or a space. Currently only patterns denoting packages are
 196   
      * supported
 197   
      *
 198   
      * @param includes the string containing the include patterns
 199   
      */
 200  0
     public void setIncludes(String includes) {
 201  0
         patternSet.setIncludes(includes);
 202   
     }
 203   
 
 204   
     /**
 205   
      * if Overwrite is set, files will be overwritten during export
 206   
      */
 207  0
     public void setOverwrite(boolean doOverwrite) {
 208  0
         overwrite = doOverwrite;
 209   
     }
 210   
 
 211   
 }
 212