ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/proposal/sandbox/clearcase/src/main/org/apache/tools/ant/taskdefs/optional/clearcase CCMatchingTask.java
Date Tue, 08 Jan 2002 13:00:02 GMT
sbailliez    02/01/08 05:00:02

  Modified:    proposal/sandbox/clearcase/src/main/org/apache/tools/ant/taskdefs/optional/clearcase
                        CCMatchingTask.java
  Log:
  Add some comments to base task
  
  Revision  Changes    Path
  1.3       +66 -14    jakarta-ant/proposal/sandbox/clearcase/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMatchingTask.java
  
  Index: CCMatchingTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/clearcase/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMatchingTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CCMatchingTask.java	7 Jan 2002 14:07:08 -0000	1.2
  +++ CCMatchingTask.java	8 Jan 2002 13:00:02 -0000	1.3
  @@ -63,33 +63,45 @@
   import org.apache.tools.ant.DirectoryScanner;
   
   /**
  + * Base task for all Clearcase tasks involving multiple-file processing.
    *
    * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
    */
   public abstract class CCMatchingTask extends MatchingTask {
  -
  +    
  +    /** view path to use. Equivalent to base directory of processing */
       protected File viewpath;
   
  +    /** cc helper tools */
       protected CCUtils utils = new CCUtils(this);
  -
  +    
  +    /** the set of collected files to checkin */
       protected Hashtable files = null;
   
  +    /** comments to use for the operation */
       protected String comment = null;
   
  +    /** the comment file created from the comments. It avoids escaping issues */
       protected File commentFile;
   
  +    /** cleartool options (and command as well) */
       protected String[] options;
   
  -    public void setViewPath(File value){
  -        this.viewpath = value;
  -    }
  -
  -    public void setComment(String value){
  -        comment = value;
  -    }
  -
  +    /**
  +     * @return a vector of options representing the cleartool arguments.
  +     * The last arguments is normally allocated and replaced at the last
  +     * moment before running the command.
  +     * @see #execute(String[], CCFile)
  +     */
       protected abstract Vector getOptions();
  -
  +    
  +    /**
  +     * @param file the clearcase file
  +     * @return whether this file should be accepted or not by the
  +     * command to restrict the file processing and errors. For
  +     * example you might not want to checkin files that are
  +     * already checked in and that are collected by the fileset
  +     */
       protected boolean accept(CCFile file){
           return true;
       }
  @@ -102,7 +114,8 @@
               postExecute();
           }
       }
  -
  +    
  +    /** check for attributes and builds the options array */
       protected void preExecute() throws BuildException {
           if (viewpath == null){
               throw new BuildException("Invalid viewpath");
  @@ -114,13 +127,18 @@
           options = new String[v.size()];
           v.copyInto(options);
       }
  -
  +    
  +    /** clean up method calls after doExecute */
       protected void postExecute(){
           if (commentFile != null){
               commentFile.delete();
           }
       }
   
  +    /**
  +     * The core processing. It loops over all files and calls
  +     * <tt>execute(String[], CCFile)</tt>
  +     */
       protected void doExecute() throws BuildException {
           Enumeration elems = getFiles().elements();
           log("Processing " + files.size() + " elements...");
  @@ -128,7 +146,16 @@
               execute(options, (CCFile)elems.nextElement());
           }
       }
  -
  +    
  +    /**
  +     * Calls the cleartool command with the appropriate parameters. Note the
  +     * the last array element is supposed to be used by the filepath.
  +     * @param args the cleartool command to execute. The last element being allocated
  +     * and representing the filepath.
  +     * @param file the file element to process.
  +     * @throws BuildException thrown if an error occurs when processing the
  +     * cleartool command.
  +     */
       protected void execute(String[] args, CCFile file) throws BuildException {
           args[args.length - 1] = file.getPath();
           CmdResult res = utils.cleartool(args);
  @@ -137,6 +164,12 @@
           }
       }
   
  +    /**
  +     * Restrict the set of files/directories to be processed.
  +     * @return the set of files to be processed. The key is made up
  +     * the filepath and the value is the <tt>CCFile</tt> instance.
  +     * @see #accept(CCFile)
  +     */
       protected Hashtable getFiles(){
           if (files != null){
               return files;
  @@ -150,6 +183,14 @@
           return files;
       }
   
  +    /**
  +     * Helper method to restrict a set of relative elements and add them
  +     * to a map.
  +     * @param map the map w/ a path/CCFile mapping to add elements to.
  +     * @param basedir the base directory for all elements in the array.
  +     * @param elems the set of elements to restrict.
  +     * @see #accept(CCFile)
  +     */
       protected void addElements(Hashtable map, File basedir, String[] elems){
           for (int i = 0; i < elems.length; i++){
               CCFile f = new CCFile(basedir, elems[i]);
  @@ -158,4 +199,15 @@
               }
           }
       }
  +
  +// Ant bean setters
  +    
  +    public void setViewPath(File value){
  +        this.viewpath = value;
  +    }
  +
  +    public void setComment(String value){
  +        comment = value;
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message