ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce P4OutputStream.java P4HandlerAdapter.java P4Revert.java P4Submit.java FStatP4OutputHandler.java P4Add.java P4Base.java P4Counter.java P4Label.java P4Handler.java P4Integrate.java P4Labelsync.java SimpleP4OutputHandler.java P4Delete.java P4OutputHandler.java P4Sync.java P4Resolve.java P4Change.java P4Reopen.java P4Fstat.java P4Edit.java
Date Mon, 14 Jul 2003 22:13:19 GMT
antoine     2003/07/14 15:13:19

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        P4OutputStream.java P4HandlerAdapter.java
                        P4Revert.java P4Submit.java
                        FStatP4OutputHandler.java P4Add.java P4Base.java
                        P4Counter.java P4Label.java P4Handler.java
                        P4Integrate.java P4Labelsync.java
                        SimpleP4OutputHandler.java P4Delete.java
                        P4OutputHandler.java P4Sync.java P4Resolve.java
                        P4Change.java P4Reopen.java P4Fstat.java
                        P4Edit.java
  Log:
  checkstyle
  remainders : mostly instance variables which should be private but are protected or public
  
  Revision  Changes    Path
  1.2       +122 -118  ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java
  
  Index: P4OutputStream.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- P4OutputStream.java	6 Jun 2003 21:12:13 -0000	1.1
  +++ P4OutputStream.java	14 Jul 2003 22:13:17 -0000	1.2
  @@ -1,118 +1,122 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2003 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "Ant" and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -package org.apache.tools.ant.taskdefs.optional.perforce;
  -
  -import java.io.OutputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.IOException;
  -
  -/**
  - * heavily inspired from LogOutputStream
  - * this stream class calls back the P4Handler on each line of stdout or stderr read
  - * @author : <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a>
  - */
  -public class P4OutputStream extends OutputStream {
  -    private P4Handler handler;
  -    private ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  -    private boolean skip = false;
  -
  -    /**
  -     * creates a new P4OutputStream for a P4Handler
  -     * @param handler
  -     */
  -    public P4OutputStream(P4Handler handler) {
  -        this.handler = handler;
  -    }
  -
  -    /**
  -     * Write the data to the buffer and flush the buffer, if a line
  -     * separator is detected.
  -     *
  -     * @param cc data to log (byte).
  -     */
  -    public void write(int cc) throws IOException {
  -        final byte c = (byte) cc;
  -        if ((c == '\n') || (c == '\r')) {
  -            if (!skip) {
  -                processBuffer();
  -            }
  -        } else {
  -            buffer.write(cc);
  -        }
  -        skip = (c == '\r');
  -    }
  -
  -
  -    /**
  -     * Converts the buffer to a string and sends it to <code>processLine</code>
  -     */
  -    protected void processBuffer() {
  -        handler.process(buffer.toString());
  -        buffer.reset();
  -    }
  -
  -    /**
  -     * Writes all remaining
  -     */
  -    public void close() throws IOException {
  -        if (buffer.size() > 0) {
  -            processBuffer();
  -        }
  -        super.close();
  -    }
  -
  -}
  -
  -
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "Ant" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
  +package org.apache.tools.ant.taskdefs.optional.perforce;
  +
  +import java.io.OutputStream;
  +import java.io.ByteArrayOutputStream;
  +import java.io.IOException;
  +
  +/**
  + * heavily inspired from LogOutputStream
  + * this stream class calls back the P4Handler on each line of stdout or stderr read
  + * @author : <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a>
  + */
  +public class P4OutputStream extends OutputStream {
  +    private P4Handler handler;
  +    private ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  +    private boolean skip = false;
  +
  +    /**
  +     * creates a new P4OutputStream for a P4Handler
  +     * @param handler   the handler which will process the streams
  +     */
  +    public P4OutputStream(P4Handler handler) {
  +        this.handler = handler;
  +    }
  +
  +    /**
  +     * Write the data to the buffer and flush the buffer, if a line
  +     * separator is detected.
  +     *
  +     * @param cc data to log (byte).
  +     * @throws IOException IOException  if an I/O error occurs. In particular,
  +     *             an <code>IOException</code> may be thrown if the
  +     *             output stream has been closed.
  +     */
  +    public void write(int cc) throws IOException {
  +        final byte c = (byte) cc;
  +        if ((c == '\n') || (c == '\r')) {
  +            if (!skip) {
  +                processBuffer();
  +            }
  +        } else {
  +            buffer.write(cc);
  +        }
  +        skip = (c == '\r');
  +    }
  +
  +
  +    /**
  +     * Converts the buffer to a string and sends it to <code>processLine</code>
  +     */
  +    protected void processBuffer() {
  +        handler.process(buffer.toString());
  +        buffer.reset();
  +    }
  +
  +    /**
  +     * Writes all remaining
  +     * @throws IOException if an I/O error occurs.
  +     */
  +    public void close() throws IOException {
  +        if (buffer.size() > 0) {
  +            processBuffer();
  +        }
  +        super.close();
  +    }
  +
  +}
  +
  +
  
  
  
  1.15      +37 -8     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java
  
  Index: P4HandlerAdapter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- P4HandlerAdapter.java	23 Jun 2003 09:06:59 -0000	1.14
  +++ P4HandlerAdapter.java	14 Jul 2003 22:13:17 -0000	1.15
  @@ -62,8 +62,9 @@
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.taskdefs.PumpStreamHandler;
   /**
  - *    base class to manage streams around the execution of the Perforce
  - *    command line client
  + * base class to manage streams around the execution of the Perforce
  + * command line client
  + * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
    */
   public abstract class P4HandlerAdapter  implements P4Handler {
   
  @@ -79,15 +80,21 @@
       /**
        * subclasses of P4HandlerAdapter must implement this routine
        * processing of one line of stdout or of stderr
  -     * @param line
  +     * @param line line of stdout or stderr to process
        */
       public abstract void process(String line);
   
  +    /**
  +     * this routine gets called by the execute routine of the Execute class
  +     * it connects the PumpStreamHandler to the input/output/error streams of the process.
  +     * @throws BuildException
  +     * @see org.apache.tools.ant.taskdefs.Execute#execute
  +     */
       public void start() throws BuildException {
           if (p4input != null && p4input.length() > 0) {
  -            myHandler = new PumpStreamHandler(new P4OutputStream(this),new P4OutputStream(this), new ByteArrayInputStream(p4input.getBytes()));
  -        }
  -        else {
  +            myHandler = new PumpStreamHandler(new P4OutputStream(this), new P4OutputStream(this),
  +                new ByteArrayInputStream(p4input.getBytes()));
  +        } else {
               myHandler = new PumpStreamHandler(new P4OutputStream(this), new P4OutputStream(this));
           }
           myHandler.setProcessInputStream(os);
  @@ -96,22 +103,44 @@
           myHandler.start();
       }
   
  +    /**
  +     * stops the processing of streams
  +     * called from P4Base#execP4Command(String command, P4Handler handler)
  +     * @see P4Base#execP4Command(String, P4Handler)
  +     */
       public void stop() {
           myHandler.stop();
       }
   
  -    OutputStream os;    //OUtput
  -    InputStream is;     //Input
  +    OutputStream os;    //Input
  +    InputStream is;     //Output
       InputStream es;     //Error
   
  +    /**
  +     * connects the handler to the input stream into Perforce
  +     * used indirectly by tasks requiring to send specific standard input
  +     * such as p4label, p4change
  +     * @param os the stream bringing input to the p4 executable
  +     * @throws IOException under unknown circumstances
  +     */
       public void setProcessInputStream(OutputStream os) throws IOException {
           this.os = os;
       }
   
  +    /**
  +     * connects the handler to the stderr of the Perforce process
  +     * @param is stderr coming from Perforce
  +     * @throws IOException under unknown circumstances
  +     */
       public void setProcessErrorStream(InputStream is) throws IOException {
           this.es = is;
       }
   
  +    /**
  +     * connects the handler to the stdout of the Perforce process
  +     * @param is stdout coming from Perforce
  +     * @throws IOException under unknown circumstances
  +     */
       public void setProcessOutputStream(InputStream is) throws IOException {
           this.is = is;
       }
  
  
  
  1.12      +8 -0      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java
  
  Index: P4Revert.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- P4Revert.java	10 Feb 2003 14:14:19 -0000	1.11
  +++ P4Revert.java	14 Jul 2003 22:13:17 -0000	1.12
  @@ -75,6 +75,8 @@
   
       /**
        * The changelist to revert; optional.
  +     * @param revertChange : the change list to revert
  +     * @throws BuildException if the change list is null or empty string
        */
       public void setChange(String revertChange) throws BuildException {
           if (revertChange == null && !revertChange.equals("")) {
  @@ -87,11 +89,17 @@
   
       /**
        * flag to revert only unchanged files (p4 revert -a); optional, default false.
  +     * @param onlyUnchanged if set to true revert only unchanged files
        */
       public void setRevertOnlyUnchanged(boolean onlyUnchanged) {
           this.onlyUnchanged = onlyUnchanged;
       }
   
  +    /**
  +     * do the work
  +     * @throws BuildException if an error occurs during the execution of the Perforce command
  +     * and failonError is set to true
  +     */
       public void execute() throws BuildException {
   
           /* Here we can either revert any unchanged files in a changelist
  
  
  
  1.15      +21 -5     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
  
  Index: P4Submit.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- P4Submit.java	10 Feb 2003 14:14:19 -0000	1.14
  +++ P4Submit.java	14 Jul 2003 22:13:18 -0000	1.15
  @@ -79,15 +79,23 @@
   public class P4Submit extends P4Base {
   
       //ToDo: If dealing with default cl need to parse out <enter description here>
  +    /**
  +     * change list number
  +     */
       public String change;
   
       /**
  +     * set the change list number to submit
        * @param change The changelist number to submit; required.
        */
       public void setChange(String change) {
           this.change = change;
       }
   
  +    /**
  +     * do the work
  +     * @throws BuildException if no change list specified
  +     */
       public void execute() throws BuildException {
           if (change != null) {
               execP4Command("submit -c " + change, (P4HandlerAdapter) new P4SubmitAdapter());
  @@ -98,10 +106,17 @@
           }
       }
   
  +    /**
  +     * internal class used to process the output of p4 submit
  +     */
       public class P4SubmitAdapter extends P4HandlerAdapter {
  +        /**
  +         * process a line of stdout/stderr coming from Perforce
  +         * @param line line of stdout or stderr coming from Perforce
  +         */
           public void process(String line) {
               log(line, Project.MSG_VERBOSE);
  -            getProject().setProperty("p4.needsresolve","0");
  +            getProject().setProperty("p4.needsresolve", "0");
               // this type of output might happen
               // Change 18 renamed change 20 and submitted.
               if (util.match("/renamed/", line)) {
  @@ -111,12 +126,13 @@
                       boolean found = false;
                       for (int counter = 0; counter < myarray.size(); counter++) {
                           if (found == true) {
  -                            int changenumber = Integer.parseInt((String) myarray.elementAt(counter + 1));
  +                            String chnum = (String) myarray.elementAt(counter + 1);
  +                            int changenumber = Integer.parseInt(chnum);
                               log("Perforce change renamed " + changenumber, Project.MSG_INFO);
                               getProject().setProperty("p4.change", "" + changenumber);
                               found = false;
                           }
  -                        if (((String) (myarray.elementAt(counter))).equals("renamed")) {
  +                        if (((myarray.elementAt(counter))).equals("renamed")) {
                               found = true;
                           }
                       }
  @@ -128,8 +144,8 @@
                       throw new BuildException(msg, e, getLocation());
                   }
               }
  -            if (util.match("/p4 submit -c/",line)) {
  -                getProject().setProperty("p4.needsresolve","1");
  +            if (util.match("/p4 submit -c/", line)) {
  +                getProject().setProperty("p4.needsresolve", "1");
               }
   
           }
  
  
  
  1.3       +3 -3      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java
  
  Index: FStatP4OutputHandler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FStatP4OutputHandler.java	10 Feb 2003 14:14:18 -0000	1.2
  +++ FStatP4OutputHandler.java	14 Jul 2003 22:13:18 -0000	1.3
  @@ -58,9 +58,9 @@
   
   import java.util.ArrayList;
   
  -/** 
  +/**
    * FStatP4OutputHandler  - spezialied Perforce output handler
  - * able to sort files recognized as managed by Perforce and files not 
  + * able to sort files recognized as managed by Perforce and files not
    * managed by Perforce in the output
    *
    * @author <A HREF="mailto:miha@softhome.net">Miha</A>
  @@ -83,7 +83,7 @@
               String f = util.group(1);
               nonExisting.add(f);
           }
  -        parent.log(parent.util.substitute("s/^.*: //", line), 
  +        parent.log(parent.util.substitute("s/^.*: //", line),
                      Project.MSG_VERBOSE);
       }
   
  
  
  
  1.15      +25 -5     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
  
  Index: P4Add.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- P4Add.java	4 Apr 2003 13:51:12 -0000	1.14
  +++ P4Add.java	14 Jul 2003 22:13:18 -0000	1.15
  @@ -72,9 +72,16 @@
    * <b>Example Usage:</b>
    * <table border="1">
    * <th>Function</th><th>Command</th>
  - * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings specified</td><td>&lt;P4add <br>P4view="//projects/foo/main/source/..." <br>P4User="fbloggs" <br>P4Port="km01:1666" <br>P4Client="fbloggsclient"&gt;<br>&lt;fileset basedir="dir" includes="**&#47;*.java"&gt;<br>&lt;/p4add&gt;</td></tr>
  - * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings defined in environment</td><td>&lt;P4add P4view="//projects/foo/main/source/..." /&gt;<br>&lt;fileset basedir="dir" includes="**&#47;*.java"&gt;<br>&lt;/p4add&gt;</td></tr>
  - * <tr><td>Specify the length of command line arguments to pass to each invocation of p4</td><td>&lt;p4add Commandlength="450"&gt;</td></tr>
  + * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings specified</td>
  + * <td>&lt;P4add <br>P4view="//projects/foo/main/source/..." <br>P4User="fbloggs"
  + * <br>P4Port="km01:1666"
  + * <br>P4Client="fbloggsclient"&gt;<br>&lt;fileset basedir="dir" includes="**&#47;*.java"&gt;<br>
  + * &lt;/p4add&gt;</td></tr>
  + * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings defined in environment</td><td>
  + * &lt;P4add P4view="//projects/foo/main/source/..." /&gt;<br>&lt;fileset basedir="dir"
  + * includes="**&#47;*.java"&gt;<br>&lt;/p4add&gt;</td></tr>
  + * <tr><td>Specify the length of command line arguments to pass to each invocation of p4</td>
  + * <td>&lt;p4add Commandlength="450"&gt;</td></tr>
    * </table>
    *
    * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
  @@ -83,17 +90,19 @@
    * @ant.task category="scm"
    */
   public class P4Add extends P4Base {
  -
  +    private static final int DEFAULT_CMD_LENGTH = 450;
       private int changelist;
       private String addCmd = "";
       private Vector filesets = new Vector();
  -    private int cmdLength = 450;
  +    private int cmdLength = DEFAULT_CMD_LENGTH;
   
       /**
        *   positive integer specifying the maximum length
        *   of the commandline when calling Perforce to add the files.
        *   Defaults to 450, higher values mean faster execution,
        *   but also possible failures.
  +     *   @param len maximum length of command line default is 450.
  +     *   @throws BuildException if trying to set the command line length to 0 or less.
        */
   
       public void setCommandlength(int len) throws BuildException {
  @@ -107,6 +116,10 @@
        * If specified the open files are associated with the
        * specified pending changelist number; otherwise the open files are
        * associated with the default changelist.
  +     *
  +     * @param changelist the change list number
  +     *
  +     * @throws BuildException if trying to set a change list number &lt;=0.
        */
       public void setChangelist(int changelist) throws BuildException {
           if (changelist <= 0) {
  @@ -118,11 +131,18 @@
   
       /**
        * files to add
  +     *
  +     * @param set the FileSet that one wants to add to Perforce Source Control
        */
       public void addFileset(FileSet set) {
           filesets.addElement(set);
       }
   
  +    /**
  +     * run the task.
  +     *
  +     * @throws BuildException if the execution of the Perforce command fails.
  +     */
       public void execute() throws BuildException {
   
           if (P4View != null) {
  
  
  
  1.23      +52 -10    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  
  Index: P4Base.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- P4Base.java	10 Feb 2003 14:14:18 -0000	1.22
  +++ P4Base.java	14 Jul 2003 22:13:18 -0000	1.23
  @@ -75,7 +75,7 @@
    * @see P4Edit
    * @see P4Submit
    * @see P4Label
  - * @see org.apache.tools.ant.taskdefs.Exec
  + * @see org.apache.tools.ant.taskdefs.Execute
    * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
    */
   public abstract class P4Base extends org.apache.tools.ant.Task {
  @@ -112,6 +112,8 @@
       /**
        * The p4d server and port to connect to;
        * optional, default "perforce:1666"
  +     *
  +     * @param P4Port the port one wants to set such as localhost:1666
        */
       public void setPort(String P4Port) {
           this.P4Port = "-p" + P4Port;
  @@ -120,6 +122,8 @@
       /**
        * The p4 client spec to use;
        * optional, defaults to the current user
  +     *
  +     * @param P4Client the name of the Perforce client spec
        */
       public void setClient(String P4Client) {
           this.P4Client = "-c" + P4Client;
  @@ -128,22 +132,34 @@
       /**
        * The p4 username;
        * optional, defaults to the current user
  +     *
  +     * @param P4User the user name
        */
       public void setUser(String P4User) {
           this.P4User = "-u" + P4User;
       }
  -    
       /**
        * Set global P4 options; Used on all
        * of the Perforce tasks.
  -     */ 
  +     *
  +     * @param P4Opts global options, to use a specific P4Config file for instance
  +     */
       public void setGlobalopts(String P4Opts) {
           this.P4Opts = P4Opts;
       }
  -
       /**
        * The client, branch or label view to operate upon;
  -     * optional default "//..."
  +     * optional default "//...".
  +     *
  +     * the view is required for the following tasks :
  +     * <ul>
  +     * <li>p4delete</li>
  +     * <li>p4edit</li>
  +     * <li>p4reopen</li>
  +     * <li>p4resolve</li>
  +     * </ul>
  +     *
  +     * @param P4View the view one wants to use
        */
       public void setView(String P4View) {
           this.P4View = P4View;
  @@ -152,6 +168,9 @@
       /**
        * Set extra command options; only used on some
        * of the Perforce tasks.
  +     *
  +     * @param P4CmdOpts  command line options going after the particular
  +     * Perforce command
        */
       public void setCmdopts(String P4CmdOpts) {
           this.P4CmdOpts = P4CmdOpts;
  @@ -160,11 +179,24 @@
       /**
        * whether to stop the build (true, default)
        * or keep going if an error is returned from the p4 command
  +     * @param fail indicates whether one wants to fail the build if an error comes from the
  +     * Perforce command
        */
       public void setFailonerror(boolean fail) {
           failOnError = fail;
       }
  -
  +    /**
  +     *  sets attributes Port, Client, User from properties
  +     *  if these properties are defined.
  +     *  Called automatically by UnknownElement
  +     *  @see org.apache.tools.ant.UnknownElement
  +     *  <table>
  +     *  <tr><th>Property</th><th>Attribute</th></tr>
  +     *  <tr><td>p4.port</td><td>Port</td></tr>
  +     *  <tr><td>p4.client</td><td>Client</td></tr>
  +     *  <tr><td>p4.user</td><td>User</td></tr>
  +     *  </table>
  +     */
       public void init() {
   
           util = new Perl5Util();
  @@ -182,14 +214,23 @@
               setUser(tmpprop);
           }
       }
  -
  +    /**
  +    *  no usages found for this method
  +    *  runs a Perforce command without a handler
  +    * @param command the command that one wants to execute
  +    * @throws BuildException if failonerror is set and the command fails
  +    */
       protected void execP4Command(String command) throws BuildException {
           execP4Command(command, null);
       }
   
  -    /** Execute P4 command assembled by subclasses.
  -     @param command The command to run
  -     @param handler A P4Handler to process any input and output
  +    /**
  +     * Execute P4 command assembled by subclasses.
  +     *
  +     * @param command The command to run
  +     * @param handler A P4Handler to process any input and output
  +     *
  +     * @throws BuildException if failonerror has been set to true
        */
       protected void execP4Command(String command, P4Handler handler) throws BuildException {
           try {
  @@ -232,6 +273,7 @@
                   try {
                       handler.stop();
                   } catch (Exception e) {
  +                    log(e.toString(), Project.MSG_ERR);
                   }
               }
   
  
  
  
  1.12      +24 -2     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
  
  Index: P4Counter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- P4Counter.java	10 Feb 2003 14:14:18 -0000	1.11
  +++ P4Counter.java	14 Jul 2003 22:13:18 -0000	1.12
  @@ -86,14 +86,30 @@
    */
   
   public class P4Counter extends P4Base {
  +    /**
  +     * name of the counter
  +     */
       public String counter = null;
  +    /**
  +     * name of an optional property
  +     */
       public String property = null;
  +    /**
  +     * flag telling whether the value of the counter should be set
  +     */
       public boolean shouldSetValue = false;
  +    /**
  +     * flag telling whether a property should be set
  +     */
       public boolean shouldSetProperty = false;
  +    /**
  +     * new value for the counter
  +     */
       public int value = 0;
   
       /**
        * The name of the counter; required
  +     * @param counter name of the counter
        */
       public void setName(String counter) {
           this.counter = counter;
  @@ -101,6 +117,7 @@
   
       /**
        * The new value for the counter; optional.
  +     * @param value new value for the counter
        */
       public void setValue(int value) {
           this.value = value;
  @@ -109,6 +126,8 @@
   
       /**
        * A property to be set with the value of the counter
  +     * @param property the name of a property to set with the value
  +     * of the counter
        */
       public void setProperty(String property) {
           this.property = property;
  @@ -117,6 +136,7 @@
   
       /**
        * again, properties are mutable in this tsk
  +     * @throws BuildException if the required parameters are not supplied.
        */
       public void execute() throws BuildException {
   
  @@ -125,7 +145,8 @@
           }
   
           if (shouldSetValue && shouldSetProperty) {
  -            throw new BuildException("Cannot both set the value of the property and retrieve the value of the property.");
  +            throw new BuildException("Cannot both set the value of the property and retrieve the "
  +                + "value of the property.");
           }
   
           String command = "counter " + P4CmdOpts + " " + counter;
  @@ -150,7 +171,8 @@
                           value = Integer.parseInt(line);
                           myProj.setProperty(property, "" + value);
                       } catch (NumberFormatException nfe) {
  -                        throw new BuildException("Perforce error. Could not retrieve counter value.");
  +                        throw new BuildException("Perforce error. "
  +                        + "Could not retrieve counter value.");
                       }
                   }
               };
  
  
  
  1.17      +9 -5      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
  
  Index: P4Label.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- P4Label.java	10 Feb 2003 14:14:19 -0000	1.16
  +++ P4Label.java	14 Jul 2003 22:13:18 -0000	1.17
  @@ -88,6 +88,7 @@
   
       /**
        * The name of the label; optional, default "AntLabel"
  +     * @param name the name of the label
        */
       public void setName(String name) {
           this.name = name;
  @@ -95,6 +96,7 @@
   
       /**
        *Label Description; optional
  +     * @param desc description of the label
        */
       public void setDesc(String desc) {
           this.desc = desc;
  @@ -102,13 +104,15 @@
   
       /**
        * when set to "locked", Perforce will lock the label once created; optional.
  +     * @param lock only admissible value "locked"
        */
       public void setLock(String lock) {
           this.lock = lock;
       }
   
       /**
  -     *  do the work
  +     * do the work
  +     * @throws BuildException if failonerror has been set to true and Perforce fails
        */
       public void execute() throws BuildException {
           log("P4Label exec:", Project.MSG_INFO);
  @@ -142,10 +146,10 @@
   
           //We have to create a unlocked label first
           String newLabel =
  -                "Label: " + name +
  -                "\nDescription: " + desc +
  -                "\nOptions: unlocked" +
  -                "\nView: \n\t" + P4View;
  +                "Label: " + name
  +                + "\nDescription: " + desc
  +                + "\nOptions: unlocked"
  +                + "\nView: \n\t" + P4View;
   
           P4Handler handler = new P4HandlerAdapter() {
               public void process(String line) {
  
  
  
  1.7       +12 -10    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java
  
  Index: P4Handler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- P4Handler.java	23 Jun 2003 09:07:30 -0000	1.6
  +++ P4Handler.java	14 Jul 2003 22:13:18 -0000	1.7
  @@ -64,15 +64,17 @@
    */
   public interface P4Handler extends ExecuteStreamHandler {
   
  -  /**
  -   * processing of one line of stdout or of stderr
  -   * @param line
  -   */
  -    public void process(String line) throws BuildException;
  +    /**
  +     * processing of one line of stdout or of stderr
  +     * @param line a line of stdout or stderr that the implementation will process
  +     * @throws BuildException at the discretion of the implementation.
  +     */
  +    void process(String line) throws BuildException;
   
  -  /**
  -   *  set any data to be written to P4's stdin
  -   *  @param line the text to write to P4's stdin
  -   */
  -    public void setOutput(String line) throws BuildException;
  +    /**
  +     * set any data to be written to P4's stdin
  +     * @param line the text to write to P4's stdin
  +     * @throws BuildException if the line cannot be processed.
  +     */
  +    void setOutput(String line) throws BuildException;
   }
  
  
  
  1.6       +23 -22    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Integrate.java
  
  Index: P4Integrate.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Integrate.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- P4Integrate.java	21 Apr 2003 14:21:16 -0000	1.5
  +++ P4Integrate.java	14 Jul 2003 22:13:18 -0000	1.6
  @@ -67,7 +67,8 @@
    * although P4Integrate can open files to the default change,
    * P4Submit cannot yet submit to it.
    * Example Usage:<br>
  - * &lt;p4integrate change="${p4.change}" fromfile="//depot/project/dev/foo.txt" tofile="//depot/project/main/foo.txt" /&gt;
  + * &lt;p4integrate change="${p4.change}"
  + * fromfile="//depot/project/dev/foo.txt" tofile="//depot/project/main/foo.txt" /&gt;
    *
    * @author <A HREF="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</A>
    *
  @@ -279,15 +280,18 @@
       /**
        *   sets flag indicating if one wants to propagate the source file type
        *
  -     *   @param propagatesourcefiletype set it to true if you want to change the type of existing target files according to type of source file.
  +     *   @param propagatesourcefiletype
  +     *   set it to true if you want to change the type of existing target files
  +     *   according to type of source file.
        */
       public void setPropagatesourcefiletype(boolean propagatesourcefiletype) {
           this.propagatesourcefiletype = propagatesourcefiletype;
       }
       /**
  -     *   returns flag indicating if one wants to suppress the copying on the local hard disk of new target files
  +     *   indicates intention to suppress the copying on the local hard disk of new target files.
        *
  -     *   @return flag indicating if one wants to suppress the copying on the local hard disk of new target files
  +     *   @return indicates intention to suppress the copying
  +     *   on the local hard disk of new target files.
        */
       public boolean isNocopynewtargetfiles() {
           return nocopynewtargetfiles;
  @@ -296,7 +300,8 @@
       /**
        *   sets nocopynewtargetfiles flag
        *
  -     *   @param nocopynewtargetfiles set it to true to gain speed in integration by not copying on the local Perforce client new target files
  +     *   @param nocopynewtargetfiles set it to true to gain speed in integration by not copying on
  +     *   the local Perforce client new target files
        */
       public void setNocopynewtargetfiles(boolean nocopynewtargetfiles) {
           this.nocopynewtargetfiles = nocopynewtargetfiles;
  @@ -304,6 +309,7 @@
   
       /**
        *  execute the p4 integrate
  +     *  @throws BuildException if there are missing parameters
        */
       public void execute() throws BuildException {
           if (change != null) {
  @@ -315,39 +321,34 @@
           if (this.restoredeletedrevisions) {
                   P4CmdOpts = P4CmdOpts + " -d";
               }
  -        if ( this.leavetargetrevision) {
  +        if (this.leavetargetrevision) {
               P4CmdOpts = P4CmdOpts + " -h";
           }
  -        if ( this.enablebaselessmerges ) {
  +        if (this.enablebaselessmerges) {
               P4CmdOpts = P4CmdOpts + " -i";
           }
  -        if (this.simulationmode ) {
  +        if (this.simulationmode) {
               P4CmdOpts = P4CmdOpts + " -n";
           }
  -        if ( this.reversebranchmappings ) {
  +        if (this.reversebranchmappings) {
               P4CmdOpts = P4CmdOpts + " -r";
           }
  -        if ( this.propagatesourcefiletype ) {
  +        if (this.propagatesourcefiletype) {
               P4CmdOpts = P4CmdOpts + " -t";
           }
  -        if ( this.nocopynewtargetfiles ) {
  +        if (this.nocopynewtargetfiles) {
               P4CmdOpts = P4CmdOpts + "-v";
           }
           String command;
           if (branch == null && fromfile != null && tofile != null) {
              command = P4CmdOpts + " " + fromfile + " " + tofile;
  -
  -        }
  -        else if ( branch != null && fromfile == null && tofile != null )
  -            {
  +        } else if (branch != null && fromfile == null && tofile != null) {
               command = P4CmdOpts + " -b " + branch + " " + tofile;
  -        }
  -        else if ( branch != null && fromfile != null )
  -            {
  -            command = P4CmdOpts + " -b " + branch + " -s "+ fromfile + " " + tofile;
  -        }
  -        else {
  -            throw new BuildException("you need to specify fromfile and tofile, or branch and tofile, or branch and fromfile, or branch and fromfile and tofile ");
  +        } else if (branch != null && fromfile != null) {
  +            command = P4CmdOpts + " -b " + branch + " -s " + fromfile + " " + tofile;
  +        } else {
  +            throw new BuildException("you need to specify fromfile and tofile, "
  +            + "or branch and tofile, or branch and fromfile, or branch and fromfile and tofile ");
           }
           execP4Command("-s integrate " + command, new SimpleP4OutputHandler(this));
       }
  
  
  
  1.4       +21 -12    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Labelsync.java
  
  Index: P4Labelsync.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Labelsync.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- P4Labelsync.java	4 Jul 2003 14:04:55 -0000	1.3
  +++ P4Labelsync.java	14 Jul 2003 22:13:18 -0000	1.4
  @@ -70,7 +70,8 @@
    *
    * Example Usage:
    * <pre>
  - *   &lt;p4labelsync name="MyLabel-${TSTAMP}-${DSTAMP}" view="//depot/...#head;//depot2/file1#25" /&gt;
  + *   &lt;p4labelsync name="MyLabel-${TSTAMP}-${DSTAMP}"
  + *   view="//depot/...#head;//depot2/file1#25" /&gt;
    * </pre>
    *
    * @author <A HREF="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</A>
  @@ -84,7 +85,8 @@
       private boolean delete; /* -n */
       private boolean simulationmode;  /* -n */
       /**
  -     * -a flag of p4 labelsync - preserve files which exist in the label, but not in the current view
  +     * -a flag of p4 labelsync - preserve files which exist in the label,
  +     * but not in the current view
        * @return  add attribute
        * if set to true the task will not remove any files from the label
        * only add files which were not there previously or update these where the revision has changed
  @@ -94,7 +96,8 @@
           return add;
       }
       /**
  -     * -a flag of p4 labelsync - preserve files which exist in the label, but not in the current view
  +     * -a flag of p4 labelsync - preserve files which exist in the label,
  +     * but not in the current view
        * @param add  if set to true the task will not remove any files from the label
        * only add files which were not there previously or update these where the revision has changed
        * the add attribute is the -a flag of p4 labelsync
  @@ -103,7 +106,8 @@
           this.add = add;
       }
       /**
  -     * -d flag of p4 labelsync; indicates an intention of deleting from the label the files specified in the view
  +     * -d flag of p4 labelsync; indicates an intention of deleting from the label
  +     * the files specified in the view
        * @return  delete attribute
        */
       public boolean isDelete() {
  @@ -111,8 +115,10 @@
       }
   
       /**
  -     * -d flag of p4 labelsync; indicates an intention of deleting from the label the files specified in the view
  -     * @param delete
  +     * -d flag of p4 labelsync; indicates an intention of deleting from the label
  +     *  the files specified in the view
  +     * @param delete indicates intention of deleting from the label
  +     * the files specified in the view
        */
       public void setDelete(boolean delete) {
           this.delete = delete;
  @@ -121,6 +127,7 @@
   
       /**
        * The name of the label; optional, default "AntLabel"
  +     * @param name of the label
        */
       public void setName(String name) {
           this.name = name;
  @@ -134,7 +141,7 @@
       }
       /**
        * -n flag of p4 labelsync - display changes without actually doing them
  -     * @param simulationmode
  +     * @param simulationmode display changes without actually doing them
        */
       public void setSimulationmode(boolean simulationmode) {
           this.simulationmode = simulationmode;
  @@ -143,6 +150,7 @@
   
       /**
        *  do the work
  +     * @throws BuildException if the label name is not supplied
        */
       public void execute() throws BuildException {
           log("P4Labelsync exec:", Project.MSG_INFO);
  @@ -152,24 +160,25 @@
               P4View = StringUtils.replace(P4View, ";", "\n\t");
           }
           if (P4View == null) {
  -            P4View="";
  +            P4View = "";
           }
   
           if (name == null || name.length() < 1) {
               throw new BuildException("name attribute is compulsory for labelsync");
           }
   
  -        if ( this.isSimulationmode() ) {
  +        if (this.isSimulationmode()) {
               P4CmdOpts = P4CmdOpts + " -n";
           }
  -        if ( this.isDelete() ) {
  +        if (this.isDelete()) {
               P4CmdOpts = P4CmdOpts + " -d";
           }
  -        if ( this.isAdd() ) {
  +        if (this.isAdd()) {
               P4CmdOpts = P4CmdOpts + " -a";
           }
   
  -        execP4Command("-s labelsync -l "+name +" "+ P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this));
  +        execP4Command("-s labelsync -l " + name + " " + P4CmdOpts + " " + P4View,
  +            new SimpleP4OutputHandler(this));
   
   
       }
  
  
  
  1.14      +16 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java
  
  Index: SimpleP4OutputHandler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SimpleP4OutputHandler.java	24 May 2003 15:28:38 -0000	1.13
  +++ SimpleP4OutputHandler.java	14 Jul 2003 22:13:18 -0000	1.14
  @@ -62,14 +62,28 @@
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   
  +/**
  + * simple implementation of P4HandlerAdapter used by tasks which are not
  + * actually processing the output from Perforce
  + * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
  + */
   public class SimpleP4OutputHandler extends P4HandlerAdapter {
   
       P4Base parent;
   
  +    /**
  +     * simple constructor
  +     * @param parent  a P4Base instance
  +     */
       public SimpleP4OutputHandler(P4Base parent) {
           this.parent = parent;
       }
   
  +    /**
  +     * process one line of stderr/stdout
  +     * @param line line of output
  +     * @throws BuildException if errror output is received
  +     */
       public void process(String line) throws BuildException {
           if (parent.util.match("/^exit/", line)) {
               return;
  @@ -88,7 +102,8 @@
           //looking like this one :
           //error: //depot/file2 - label in sync.
   
  -        if (parent.util.match("/error:/", line) && !parent.util.match("/up-to-date/", line) && !parent.util.match("/label in sync/", line)) {
  +        if (parent.util.match("/error:/", line) && !parent.util.match("/up-to-date/", line)
  +            && !parent.util.match("/label in sync/", line)) {
               throw new BuildException(line);
   
           }
  
  
  
  1.10      +10 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java
  
  Index: P4Delete.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- P4Delete.java	10 Feb 2003 14:14:18 -0000	1.9
  +++ P4Delete.java	14 Jul 2003 22:13:18 -0000	1.10
  @@ -65,22 +65,31 @@
    * @todo What to do if file is already open in one of our changelists perhaps
    * (See also {@link P4Edit P4Edit})?<br>
    *
  - * @author <A HREF="mailto:mike@tmorph.com">Mike Roberts</A>, <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
  + * @author <A HREF="mailto:mike@tmorph.com">Mike Roberts</A>
  + * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
    *
    * @ant.task category="scm"
    */
   public class P4Delete extends P4Base {
   
  +    /**
  +     * number of the change list to work on
  +     */
       public String change = null;
   
       /**
        * An existing changelist number for the deletion; optional
        * but strongly recommended.
  +     * @param change the number of a change list
        */
       public void setChange(String change) {
           this.change = change;
       }
   
  +    /**
  +     * executes the p4 delete task
  +     * @throws BuildException if there is no view specified
  +     */
       public void execute() throws BuildException {
           if (change != null) {
               P4CmdOpts = "-c " + change;
  
  
  
  1.3       +7 -3      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java
  
  Index: P4OutputHandler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- P4OutputHandler.java	10 Feb 2003 14:14:19 -0000	1.2
  +++ P4OutputHandler.java	14 Jul 2003 22:13:18 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -62,6 +62,10 @@
    * @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A>
    */
   public interface P4OutputHandler {
  -
  -    public void process(String line) throws BuildException;
  +    /**
  +     * implementations will be able to process lines of output from Perforce
  +     * @param line a line of stdout or stderr coming from Perforce
  +     * @throws BuildException implementations are allowed to throw BuildException
  +     */
  +    void process(String line) throws BuildException;
   }
  
  
  
  1.13      +16 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java
  
  Index: P4Sync.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- P4Sync.java	10 Feb 2003 14:14:19 -0000	1.12
  +++ P4Sync.java	14 Jul 2003 22:13:18 -0000	1.13
  @@ -70,9 +70,13 @@
    * <b>Example Usage:</b>
    * <table border="1">
    * <th>Function</th><th>Command</th>
  - * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings specified</td><td>&lt;P4Sync <br>P4view="//projects/foo/main/source/..." <br>P4User="fbloggs" <br>P4Port="km01:1666" <br>P4Client="fbloggsclient" /&gt;</td></tr>
  - * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment</td><td>&lt;P4Sync P4view="//projects/foo/main/source/..." /&gt;</td></tr>
  - * <tr><td>Force a re-sync to head, refreshing all files</td><td>&lt;P4Sync force="yes" P4view="//projects/foo/main/source/..." /&gt;</td></tr>
  + * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings specified</td>
  + * <td>&lt;P4Sync <br>P4view="//projects/foo/main/source/..." <br>
  + * P4User="fbloggs" <br>P4Port="km01:1666" <br>P4Client="fbloggsclient" /&gt;</td></tr>
  + * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment</td>
  + * <td>&lt;P4Sync P4view="//projects/foo/main/source/..." /&gt;</td></tr>
  + * <tr><td>Force a re-sync to head, refreshing all files</td>
  + * <td>&lt;P4Sync force="yes" P4view="//projects/foo/main/source/..." /&gt;</td></tr>
    * <tr><td>Sync to a label</td><td>&lt;P4Sync label="myPerforceLabel" /&gt;</td></tr>
    * </table>
    *
  @@ -89,6 +93,8 @@
   
       /**
        * Label to sync client to; optional.
  +     * @param label name of a label against which one want to sync
  +     * @throws BuildException if label is null or empty string
        */
       public void setLabel(String label) throws BuildException {
           if (label == null && !label.equals("")) {
  @@ -102,6 +108,8 @@
   
       /**
        * force a refresh of files, if this attribute is set; false by default.
  +     * @param force sync all files, whether they are supposed to be already uptodate or not.
  +     * @throws BuildException if a label is set and force is null
        */
       public void setForce(String force) throws BuildException {
           if (force == null && !label.equals("")) {
  @@ -110,6 +118,11 @@
           P4CmdOpts = "-f";
       }
   
  +    /**
  +     * do the work
  +     * @throws BuildException if an error occurs during the execution of the Perforce command
  +     * and failOnError is set to true
  +     */
       public void execute() throws BuildException {
   
   
  
  
  
  1.6       +60 -24    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java
  
  Index: P4Resolve.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- P4Resolve.java	4 Jul 2003 14:04:55 -0000	1.5
  +++ P4Resolve.java	14 Jul 2003 22:13:18 -0000	1.6
  @@ -63,6 +63,7 @@
   
   /**
    * @ant.task category="scm"
  + * @author <a href="mailto:antoine@antbuild.com">Antoine Levy-Lambert</a>
    */
   public class P4Resolve extends P4Base {
       private String resolvemode = null;
  @@ -77,14 +78,17 @@
       private static final String SAFE = "safe";
       private static final String THEIRS = "theirs";
       private static final String YOURS = "yours";
  -    private static final String[] resolvemodes = {
  +    private static final String[] RESOLVE_MODES = {
           AUTOMATIC,
           FORCE,
           SAFE,
           THEIRS,
           YOURS
       };
  -
  +   /**
  +    * returns the resolve mode
  +    * @return  returns the resolve mode
  +    */
       public String getResolvemode() {
           return resolvemode;
       }
  @@ -97,90 +101,122 @@
        * <li> theirs -at </li>
        * <li> yours -ay </li>
        * </ul>
  +     * @param resolvemode one of automatic, force, safe, theirs, yours
        */
       public void setResolvemode(String resolvemode) {
  -        boolean found=false;
  -        for (int counter=0; counter < resolvemodes.length; counter++)
  -        {
  -            if (resolvemode.equals(resolvemodes[counter])) {
  -                found=true;
  +        boolean found = false;
  +        for (int counter = 0; counter < RESOLVE_MODES.length; counter++) {
  +            if (resolvemode.equals(RESOLVE_MODES[counter])) {
  +                found = true;
                   break;
               }
           }
  -        if (found==false) {
  +        if (found == false) {
               throw new BuildException("Unacceptable value for resolve mode");
           }
           this.resolvemode = resolvemode;
       }
   
  +    /**
  +     * allows previously resolved files to be resolved again
  +     * @return flag indicating whether one wants to
  +     * allow previously resolved files to be resolved again
  +     */
       public boolean isRedoall() {
           return redoall;
       }
   
  +    /**
  +     * set the redoall flag
  +     * @param redoall flag indicating whether one want to
  +     * allow previously resolved files to be resolved again
  +     */
       public void setRedoall(boolean redoall) {
           this.redoall = redoall;
       }
   
  +    /**
  +     * read the simulation mode flag
  +     * @return flag indicating whether one wants just to simulate
  +     * the p4 resolve operation whithout actually doing it
  +     */
       public boolean isSimulationmode() {
           return simulationmode;
       }
   
  +    /**
  +     * sets a flag
  +     * @param simulationmode set to true, lists the integrations which would be performed,
  +     * without actually doing them.
  +     */
       public void setSimulationmode(boolean simulationmode) {
           this.simulationmode = simulationmode;
       }
   
  +    /**
  +     * If set to true, attempts a textual merge, even for binary files
  +     * @return flag value
  +     */
       public boolean isForcetextmode() {
           return forcetextmode;
       }
   
  +    /**
  +     * If set to true, attempts a textual merge, even for binary files
  +     * @param forcetextmode set the flag value
  +     */
       public void setForcetextmode(boolean forcetextmode) {
           this.forcetextmode = forcetextmode;
       }
   
  +    /**
  +     * If set to true, puts in markers for all changes, conflicting or not
  +     * @return  flag markersforall value
  +     */
       public boolean isMarkersforall() {
           return markersforall;
       }
   
  +    /**
  +      * If set to true, puts in markers for all changes, conflicting or not
  +     * @param markersforall flag true or false
  +     */
       public void setMarkersforall(boolean markersforall) {
           this.markersforall = markersforall;
       }
   
       /**
        *  execute the p4 resolve
  +     * @throws BuildException if there is a wrong resolve mode specified
  +     *  or no view specified
        */
       public void execute() throws BuildException {
           if (this.resolvemode.equals(AUTOMATIC)) {
               P4CmdOpts = P4CmdOpts + " -am";
  -        }
  -        else if (this.resolvemode.equals(FORCE)) {
  +        } else if (this.resolvemode.equals(FORCE)) {
               P4CmdOpts = P4CmdOpts + " -af";
  -        }
  -        else if (this.resolvemode.equals(SAFE)) {
  +        } else if (this.resolvemode.equals(SAFE)) {
               P4CmdOpts = P4CmdOpts + " -as";
  -        }
  -        else if (this.resolvemode.equals(THEIRS)) {
  +        } else if (this.resolvemode.equals(THEIRS)) {
               P4CmdOpts = P4CmdOpts + " -at";
  -        }
  -        else if (this.resolvemode.equals(YOURS)) {
  +        } else if (this.resolvemode.equals(YOURS)) {
               P4CmdOpts = P4CmdOpts + " -ay";
  -        }
  -        else
  -        {
  +        } else {
               throw new BuildException("unsupported or absent resolve mode");
           }
  -        if (P4View==null) {
  +        if (P4View == null) {
               throw new BuildException("please specify a view");
           }
  -        if ( this.isRedoall() ) {
  +        if (this.isRedoall()) {
               P4CmdOpts = P4CmdOpts + " -f";
           }
  -        if ( this.isSimulationmode() ) {
  +        if (this.isSimulationmode()) {
               P4CmdOpts = P4CmdOpts + " -n";
           }
  -        if ( this.isForcetextmode() ) {
  +        if (this.isForcetextmode()) {
               P4CmdOpts = P4CmdOpts + " -t";
           }
  -        if ( this.isMarkersforall() ) {
  +        if (this.isMarkersforall()) {
               P4CmdOpts = P4CmdOpts + " -v";
           }
           execP4Command("-s resolve " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this));
  
  
  
  1.17      +16 -12    ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
  
  Index: P4Change.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- P4Change.java	10 Feb 2003 14:14:18 -0000	1.16
  +++ P4Change.java	14 Jul 2003 22:13:18 -0000	1.17
  @@ -81,7 +81,9 @@
       protected String description = "AutoSubmit By Ant";
   
       /**
  -     * throw all immutability rules to the wind
  +     * creates a new Perforce change list
  +     * sets the p4.change property to the number of the new change list
  +     * @throws BuildException if the word error appears in the output coming from Perforce
        */
       public void execute() throws BuildException {
   
  @@ -113,7 +115,12 @@
           execP4Command("change -i", handler);
       }
   
  -
  +    /**
  +     * returns the text of an empty change list
  +     * @return  the text of an empty change list
  +     * @throws BuildException  if the text error is displayed
  +     * in the Perforce output outside of a comment line
  +     */
       public String getEmptyChangeList() throws BuildException {
           final StringBuffer stringbuf = new StringBuffer();
   
  @@ -121,28 +128,23 @@
               public void process(String line) {
                   if (!util.match("/^#/", line)) {
                       if (util.match("/error/", line)) {
  -
                           log("Client Error", Project.MSG_VERBOSE);
  -                        throw new BuildException("Perforce Error, check client settings and/or server");
  -
  +                        throw new BuildException("Perforce Error, "
  +                        + "check client settings and/or server");
                       } else if (util.match("/<enter description here>/", line)) {
  -
                           // we need to escape the description in case there are /
                           description = backslash(description);
  -                        line = util.substitute("s/<enter description here>/" + description + "/", line);
  -
  +                        line = util.substitute("s/<enter description here>/"
  +                            + description + "/", line);
                       } else if (util.match("/\\/\\//", line)) {
                           //Match "//" for begining of depot filespec
                           return;
                       }
  -
                       stringbuf.append(line);
                       stringbuf.append("\n");
  -
                   }
               }
           });
  -
           return stringbuf.toString();
       }
   
  @@ -152,7 +154,8 @@
        * always backslashes in a string unless they escape the delimiter.
        * @param value the string to backslash for slashes
        * @return the backslashed string
  -     * @see < a href="http://jakarta.apache.org/oro/api/org/apache/oro/text/perl/Perl5Util.html#substitute(java.lang.String,%20java.lang.String)">Oro</a>
  +     * @see <a href="http://jakarta.apache.org/oro/api/org/apache/oro/text/perl/Perl5Util.html
  +     * #substitute(java.lang.String,%20java.lang.String)">Oro</a>
        */
       public static final String backslash(String value) {
           final StringBuffer buf = new StringBuffer(value.length());
  @@ -170,6 +173,7 @@
       /**
        * Description for ChangeList;optional.
        * If none is specified, it will default to "AutoSubmit By Ant"
  +     * @param desc description for the change list
        */
       public void setDescription(String desc) {
           this.description = desc;
  
  
  
  1.12      +6 -0      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java
  
  Index: P4Reopen.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- P4Reopen.java	10 Feb 2003 14:14:19 -0000	1.11
  +++ P4Reopen.java	14 Jul 2003 22:13:18 -0000	1.12
  @@ -74,6 +74,8 @@
   
       /**
        * The changelist to move files to; required.
  +     * @param toChange new change list number
  +     * @throws BuildException if the change parameter is null or empty
        */
       public void setToChange(String toChange) throws BuildException {
           if (toChange == null && !toChange.equals("")) {
  @@ -83,6 +85,10 @@
           this.toChange = toChange;
       }
   
  +    /**
  +     * do the work
  +     * @throws BuildException if P4View is null
  +     */
       public void execute() throws BuildException {
           if (P4View == null) {
               throw new BuildException("No view specified to reopen");
  
  
  
  1.6       +32 -6     ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
  
  Index: P4Fstat.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- P4Fstat.java	4 Apr 2003 13:51:12 -0000	1.5
  +++ P4Fstat.java	14 Jul 2003 22:13:18 -0000	1.6
  @@ -74,7 +74,8 @@
    *
    * <br><b>Example Usage:</b><br>
    * <pre>
  - * &lt;project name=&quot;p4fstat&quot; default=&quot;p4fstat&quot; basedir=&quot;C:\dev\gnu&quot;&gt;
  + * &lt;project name=&quot;p4fstat&quot; default=&quot;p4fstat&quot;
  + * basedir=&quot;C:\dev\gnu&quot;&gt;
    *     &lt;target name=&quot;p4fstat&quot; &gt;
    *         &lt;p4fstat showfilter=&quot;all&quot;&gt;
    *             &lt;fileset dir=&quot;depot&quot; includes=&quot;**\/*&quot;/&gt;
  @@ -94,7 +95,8 @@
       private int changelist;
       private String addCmd = "";
       private Vector filesets = new Vector();
  -    private int cmdLength = 300;
  +    private static final int DEFAULT_CMD_LENGTH = 300;
  +    private int cmdLength = DEFAULT_CMD_LENGTH;
       private static final int SHOW_ALL = 0;
       private static final int SHOW_EXISTING = 1;
       private static final int SHOW_NON_EXISTING = 2;
  @@ -110,7 +112,16 @@
       private static final String NONEXISTING_HEADER
           = "Following files do not exist in perforce";
   
  -
  +    /**
  +     * sets the filter that one wants applied
  +     * <table>
  +     * <tr><th>Option</th><th>Meaning</th></tr>
  +     * <tr><td>all</td><td>all files under Perforce control or not</td></tr>
  +     * <tr><td>existing</td><td>only files under Perforce control</td></tr>
  +     * <tr><td>non-existing</td><td>only files not under Perforce control or not</td></tr>
  +     * </table>
  +     * @param filter should be one of all|existing|non-existing
  +     */
       public void setShowFilter(String filter) {
           if (filter.equalsIgnoreCase("all")) {
               show = SHOW_ALL;
  @@ -124,7 +135,11 @@
           }
       }
   
  -
  +    /**
  +     * sets optionally a change list number
  +     * @param changelist change list that one wants information about
  +     * @throws BuildException if the change list number is negative
  +     */
       public void setChangelist(int changelist) throws BuildException {
           if (changelist <= 0) {
               throw new BuildException("P4FStat: Changelist# should be a "
  @@ -134,10 +149,18 @@
           this.changelist = changelist;
       }
   
  +    /**
  +     * adds a fileset to be examined by p4fstat
  +     * @param set the fileset to add
  +     */
       public void addFileset(FileSet set) {
           filesets.addElement(set);
       }
   
  +    /**
  +     * executes the p4fstat task
  +     * @throws BuildException if no files are specified
  +     */
       public void execute() throws BuildException {
   
           handler = new FStatP4OutputHandler(this);
  @@ -172,7 +195,7 @@
                       execP4Fstat(filelist);
                   }
               } else {
  -                log("No files specified to add!", Project.MSG_WARN);
  +                log("No files specified to query status on!", Project.MSG_WARN);
               }
           }
   
  @@ -186,7 +209,10 @@
   
       }
   
  -
  +    /**
  +     * return the number of files seen
  +     * @return the number of files seen
  +     */
       public int getLengthOfTask() {
           return fileNum;
       }
  
  
  
  1.14      +8 -0      ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java
  
  Index: P4Edit.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- P4Edit.java	10 Feb 2003 14:14:18 -0000	1.13
  +++ P4Edit.java	14 Jul 2003 22:13:18 -0000	1.14
  @@ -78,16 +78,24 @@
   
   public class P4Edit extends P4Base {
   
  +    /**
  +     * number of the change list to work on
  +     */
       public String change = null;
   
       /**
        * An existing changelist number to assign files to; optional
        * but strongly recommended.
  +     * @param change the change list number
        */
       public void setChange(String change) {
           this.change = change;
       }
   
  +    /**
  +     * Run the p4 edit command
  +     * @throws BuildException if there is no view specified
  +     */
       public void execute() throws BuildException {
           if (change != null) {
               P4CmdOpts = "-c " + change;
  
  
  

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


Mime
View raw message