You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/03/05 08:54:01 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSSCHECKOUT.java MSVSSCHECKIN.java MSVSS.java

donaldp     02/03/04 23:54:00

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss
                        MSVSSCHECKOUT.java MSVSSCHECKIN.java MSVSS.java
  Log:
  no message
  
  Revision  Changes    Path
  1.9       +60 -81    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
  
  Index: MSVSSCHECKOUT.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MSVSSCHECKOUT.java	18 Feb 2002 09:02:40 -0000	1.8
  +++ MSVSSCHECKOUT.java	5 Mar 2002 07:54:00 -0000	1.9
  @@ -18,25 +18,25 @@
    *
    * @author Martin Poeschl
    */
  -public class MSVSSCHECKOUT extends MSVSS
  +public class MSVSSCHECKOUT
  +    extends MSVSS
   {
  +    private String m_localPath;
  +    private boolean m_recursive;
  +    private String m_version;
  +    private String m_date;
  +    private String m_label;
  +    private String m_autoResponse;
   
  -    private String m_LocalPath = null;
  -    private boolean m_Recursive = false;
  -    private String m_Version = null;
  -    private String m_Date = null;
  -    private String m_Label = null;
  -    private String m_AutoResponse = null;
  -
  -    public void setAutoresponse( String response )
  +    public void setAutoresponse( final String response )
       {
           if( response.equals( "" ) || response.equals( "null" ) )
           {
  -            m_AutoResponse = null;
  +            m_autoResponse = null;
           }
           else
           {
  -            m_AutoResponse = response;
  +            m_autoResponse = response;
           }
       }
   
  @@ -47,18 +47,16 @@
        * something went wrong and that the string value got populated from a null
        * object. This happens if a ant variable is used e.g. date="${date}" when
        * date has not been defined to ant!
  -     *
  -     * @param date The new Date value
        */
  -    public void setDate( String date )
  +    public void setDate( final String date )
       {
           if( date.equals( "" ) || date.equals( "null" ) )
           {
  -            m_Date = null;
  +            m_date = null;
           }
           else
           {
  -            m_Date = date;
  +            m_date = date;
           }
       }
   
  @@ -69,39 +67,33 @@
        * something went wrong and that the string value got populated from a null
        * object. This happens if a ant variable is used e.g.
        * label="${label_server}" when label_server has not been defined to ant!
  -     *
  -     * @param label The new Label value
        */
  -    public void setLabel( String label )
  +    public void setLabel( final String label )
       {
           if( label.equals( "" ) || label.equals( "null" ) )
           {
  -            m_Label = null;
  +            m_label = null;
           }
           else
           {
  -            m_Label = label;
  +            m_label = label;
           }
       }
   
       /**
        * Set the local path.
  -     *
  -     * @param localPath The new Localpath value
        */
  -    public void setLocalpath( Path localPath )
  +    public void setLocalpath( final Path localPath )
       {
  -        m_LocalPath = localPath.toString();
  +        m_localPath = localPath.toString();
       }
   
       /**
        * Set behaviour recursive or non-recursive
  -     *
  -     * @param recursive The new Recursive value
        */
  -    public void setRecursive( boolean recursive )
  +    public void setRecursive( final boolean recursive )
       {
  -        m_Recursive = recursive;
  +        m_recursive = recursive;
       }
   
       /**
  @@ -111,90 +103,83 @@
        * something went wrong and that the string value got populated from a null
        * object. This happens if a ant variable is used e.g.
        * version="${ver_server}" when ver_server has not been defined to ant!
  -     *
  -     * @param version The new Version value
        */
  -    public void setVersion( String version )
  +    public void setVersion( final String version )
       {
           if( version.equals( "" ) || version.equals( "null" ) )
           {
  -            m_Version = null;
  +            m_version = null;
           }
           else
           {
  -            m_Version = version;
  +            m_version = version;
           }
       }
   
       /**
        * Checks the value set for the autoResponse. if it equals "Y" then we
        * return -I-Y if it equals "N" then we return -I-N otherwise we return -I
  -     *
  -     * @param cmd Description of Parameter
        */
  -    public void getAutoresponse( Commandline cmd )
  +    public void getAutoresponse( final Commandline cmd )
       {
  -
  -        if( m_AutoResponse == null )
  +        if( m_autoResponse == null )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_DEF );
           }
  -        else if( m_AutoResponse.equalsIgnoreCase( "Y" ) )
  +        else if( m_autoResponse.equalsIgnoreCase( "Y" ) )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_YES );
   
           }
  -        else if( m_AutoResponse.equalsIgnoreCase( "N" ) )
  +        else if( m_autoResponse.equalsIgnoreCase( "N" ) )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_NO );
           }
           else
           {
               cmd.addArgument( FLAG_AUTORESPONSE_DEF );
  -        }// end of else
  -
  +        }
       }
   
       /**
        * Builds and returns the -GL flag command if required <p>
        *
        * The localpath is created if it didn't exist
  -     *
  -     * @param cmd Description of Parameter
        */
  -    public void getLocalpathCommand( Commandline cmd )
  +    public void getLocalpathCommand( final Commandline cmd )
           throws TaskException
       {
  -        if( m_LocalPath == null )
  +        if( m_localPath == null )
           {
               return;
           }
           else
           {
               // make sure m_LocalDir exists, create it if it doesn't
  -            File dir = getContext().resolveFile( m_LocalPath );
  +            final File dir = getContext().resolveFile( m_localPath );
               if( !dir.exists() )
               {
  -                boolean done = dir.mkdirs();
  -                if( done == false )
  +                if( !dir.mkdirs() )
                   {
  -                    String msg = "Directory " + m_LocalPath + " creation was not " +
  +                    final String message =
  +                        "Directory " + m_localPath + " creation was not " +
                           "succesful for an unknown reason";
  -                    throw new TaskException( msg );
  +                    throw new TaskException( message );
  +                }
  +                else
  +                {
  +                    final String message = "Created dir: " + dir.getAbsolutePath();
  +                    getLogger().info( message );
                   }
  -                getLogger().info( "Created dir: " + dir.getAbsolutePath() );
               }
   
  -            cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath );
  +            cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
           }
       }
   
  -    /**
  -     * @param cmd Description of Parameter
  -     */
  -    public void getRecursiveCommand( Commandline cmd )
  +    private void getRecursiveCommand( final Commandline cmd )
       {
  -        if( !m_Recursive )
  +        if( !m_recursive )
           {
               return;
           }
  @@ -207,23 +192,20 @@
       /**
        * Simple order of priority. Returns the first specified of version, date,
        * label If none of these was specified returns ""
  -     *
  -     * @param cmd Description of Parameter
        */
  -    public void getVersionCommand( Commandline cmd )
  +    private void getVersionCommand( final Commandline cmd )
       {
  -
  -        if( m_Version != null )
  +        if( null != m_version )
           {
  -            cmd.addArgument( FLAG_VERSION + m_Version );
  +            cmd.addArgument( FLAG_VERSION + m_version );
           }
  -        else if( m_Date != null )
  +        else if( null != m_date )
           {
  -            cmd.addArgument( FLAG_VERSION_DATE + m_Date );
  +            cmd.addArgument( FLAG_VERSION_DATE + m_date );
           }
  -        else if( m_Label != null )
  +        else if( null != m_label )
           {
  -            cmd.addArgument( FLAG_VERSION_LABEL + m_Label );
  +            cmd.addArgument( FLAG_VERSION_LABEL + m_label );
           }
       }
   
  @@ -232,20 +214,18 @@
        *
        * Builds a command line to execute ss and then calls Exec's run method to
        * execute the command line.
  -     *
  -     * @exception TaskException Description of Exception
        */
       public void execute()
           throws TaskException
       {
  -        Commandline commandLine = new Commandline();
  -        int result = 0;
  +        final Commandline commandLine = new Commandline();
   
           // first off, make sure that we've got a command and a vssdir ...
  -        if( getVsspath() == null )
  +        final String vsspath = getVsspath();
  +        if( null == vsspath )
           {
  -            String msg = "vsspath attribute must be set!";
  -            throw new TaskException( msg );
  +            final String message = "vsspath attribute must be set!";
  +            throw new TaskException( message );
           }
   
           // now look for illegal combinations of things ...
  @@ -257,7 +237,7 @@
           commandLine.addArgument( COMMAND_CHECKOUT );
   
           // VSS items
  -        commandLine.addArgument( getVsspath() );
  +        commandLine.addArgument( vsspath );
           // -GL
           getLocalpathCommand( commandLine );
           // -I- or -I-Y or -I-N
  @@ -269,13 +249,12 @@
           // -Y
           getLoginCommand( commandLine );
   
  -        result = run( commandLine );
  +        final int result = run( commandLine );
           if( result != 0 )
           {
  -            String msg = "Failed executing: " + commandLine.toString();
  -            throw new TaskException( msg );
  +            final String message = "Failed executing: " + commandLine.toString();
  +            throw new TaskException( message );
           }
       }
  -
   }
   
  
  
  
  1.9       +51 -81    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
  
  Index: MSVSSCHECKIN.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MSVSSCHECKIN.java	18 Feb 2002 09:02:40 -0000	1.8
  +++ MSVSSCHECKIN.java	5 Mar 2002 07:54:00 -0000	1.9
  @@ -9,7 +9,6 @@
   
   import java.io.File;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.myrmidon.api.AbstractTask;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.Path;
   
  @@ -18,34 +17,32 @@
    *
    * @author Martin Poeschl
    */
  -public class MSVSSCHECKIN extends MSVSS
  +public class MSVSSCHECKIN
  +    extends MSVSS
   {
  -
  -    private String m_LocalPath = null;
  -    private boolean m_Recursive = false;
  -    private boolean m_Writable = false;
  -    private String m_AutoResponse = null;
  -    private String m_Comment = "-";
  +    private String m_localPath;
  +    private boolean m_recursive;
  +    private boolean m_writable;
  +    private String m_autoResponse;
  +    private String m_comment = "-";
   
       /**
        * Set behaviour, used in get command to make files that are 'got' writable
  -     *
  -     * @param argWritable The new Writable value
        */
  -    public final void setWritable( boolean argWritable )
  +    public final void setWritable( final boolean writable )
       {
  -        m_Writable = argWritable;
  +        m_writable = writable;
       }
   
  -    public void setAutoresponse( String response )
  +    public void setAutoresponse( final String autoResponse )
       {
  -        if( response.equals( "" ) || response.equals( "null" ) )
  +        if( autoResponse.equals( "" ) || autoResponse.equals( "null" ) )
           {
  -            m_AutoResponse = null;
  +            m_autoResponse = null;
           }
           else
           {
  -            m_AutoResponse = response;
  +            m_autoResponse = autoResponse;
           }
       }
   
  @@ -54,120 +51,98 @@
        *
        * If this is null or empty, it will be replaced with "-" which is what
        * SourceSafe uses for an empty comment.
  -     *
  -     * @param comment The new Comment value
        */
  -    public void setComment( String comment )
  +    public void setComment( final String comment )
       {
           if( comment.equals( "" ) || comment.equals( "null" ) )
           {
  -            m_Comment = "-";
  +            m_comment = "-";
           }
           else
           {
  -            m_Comment = comment;
  +            m_comment = comment;
           }
       }
   
       /**
        * Set the local path.
  -     *
  -     * @param localPath The new Localpath value
        */
  -    public void setLocalpath( Path localPath )
  +    public void setLocalpath( final Path localPath )
       {
  -        m_LocalPath = localPath.toString();
  +        m_localPath = localPath.toString();
       }
   
       /**
        * Set behaviour recursive or non-recursive
  -     *
  -     * @param recursive The new Recursive value
        */
  -    public void setRecursive( boolean recursive )
  +    public void setRecursive( final boolean recursive )
       {
  -        m_Recursive = recursive;
  +        m_recursive = recursive;
       }
   
       /**
        * Checks the value set for the autoResponse. if it equals "Y" then we
        * return -I-Y if it equals "N" then we return -I-N otherwise we return -I
  -     *
  -     * @param cmd Description of Parameter
        */
  -    public void getAutoresponse( Commandline cmd )
  +    public void getAutoresponse( final Commandline cmd )
       {
  -
  -        if( m_AutoResponse == null )
  +        if( null == m_autoResponse )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_DEF );
           }
  -        else if( m_AutoResponse.equalsIgnoreCase( "Y" ) )
  +        else if( m_autoResponse.equalsIgnoreCase( "Y" ) )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_YES );
   
           }
  -        else if( m_AutoResponse.equalsIgnoreCase( "N" ) )
  +        else if( m_autoResponse.equalsIgnoreCase( "N" ) )
           {
               cmd.addArgument( FLAG_AUTORESPONSE_NO );
           }
           else
           {
               cmd.addArgument( FLAG_AUTORESPONSE_DEF );
  -        }// end of else
  -
  -    }
  -
  -    /**
  -     * Gets the comment to be applied.
  -     *
  -     * @return the comment to be applied.
  -     */
  -    public String getComment()
  -    {
  -        return m_Comment;
  +        }
       }
   
       /**
        * Builds and returns the -GL flag command if required <p>
        *
        * The localpath is created if it didn't exist
  -     *
  -     * @param cmd Description of Parameter
        */
  -    public void getLocalpathCommand( Commandline cmd )
  +    private void getLocalpathCommand( final Commandline cmd )
           throws TaskException
       {
  -        if( m_LocalPath == null )
  +        if( m_localPath == null )
           {
               return;
           }
           else
           {
               // make sure m_LocalDir exists, create it if it doesn't
  -            File dir = getContext().resolveFile( m_LocalPath );
  +            final File dir = getContext().resolveFile( m_localPath );
               if( !dir.exists() )
               {
  -                boolean done = dir.mkdirs();
  -                if( done == false )
  +                final boolean done = dir.mkdirs();
  +                if( !done )
                   {
  -                    String msg = "Directory " + m_LocalPath + " creation was not " +
  +                    final String message =
  +                        "Directory " + m_localPath + " creation was not " +
                           "succesful for an unknown reason";
  -                    throw new TaskException( msg );
  +                    throw new TaskException( message );
                   }
  -                getLogger().info( "Created dir: " + dir.getAbsolutePath() );
  +
  +                final String message = "Created dir: " + dir.getAbsolutePath();
  +                getLogger().info( message );
               }
   
  -            cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath );
  +            cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath );
           }
       }
   
  -    /**
  -     * @param cmd Description of Parameter
  -     */
  -    public void getRecursiveCommand( Commandline cmd )
  +    private void getRecursiveCommand( final Commandline cmd )
       {
  -        if( !m_Recursive )
  +        if( !m_recursive )
           {
               return;
           }
  @@ -177,12 +152,9 @@
           }
       }
   
  -    /**
  -     * @param cmd Description of Parameter
  -     */
  -    public void getWritableCommand( Commandline cmd )
  +    private void getWritableCommand( final Commandline cmd )
       {
  -        if( !m_Writable )
  +        if( !m_writable )
           {
               return;
           }
  @@ -197,20 +169,18 @@
        *
        * Builds a command line to execute ss and then calls Exec's run method to
        * execute the command line.
  -     *
  -     * @exception TaskException Description of Exception
        */
       public void execute()
           throws TaskException
       {
  -        Commandline commandLine = new Commandline();
  -        int result = 0;
  +        final Commandline commandLine = new Commandline();
   
           // first off, make sure that we've got a command and a vssdir ...
  -        if( getVsspath() == null )
  +        final String vsspath = getVsspath();
  +        if( null == vsspath )
           {
  -            String msg = "vsspath attribute must be set!";
  -            throw new TaskException( msg );
  +            final String message = "vsspath attribute must be set!";
  +            throw new TaskException( message );
           }
   
           // now look for illegal combinations of things ...
  @@ -222,7 +192,7 @@
           commandLine.addArgument( COMMAND_CHECKIN );
   
           // VSS items
  -        commandLine.addArgument( getVsspath() );
  +        commandLine.addArgument( vsspath );
           // -GL
           getLocalpathCommand( commandLine );
           // -I- or -I-Y or -I-N
  @@ -234,13 +204,13 @@
           // -Y
           getLoginCommand( commandLine );
           // -C
  -        commandLine.addArgument( "-C" + getComment() );
  +        commandLine.addArgument( "-C" + m_comment );
   
  -        result = run( commandLine );
  +        final int result = run( commandLine );
           if( result != 0 )
           {
  -            String msg = "Failed executing: " + commandLine.toString();
  -            throw new TaskException( msg );
  +            final String message = "Failed executing: " + commandLine.toString();
  +            throw new TaskException( message );
           }
       }
   }
  
  
  
  1.25      +0 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  
  Index: MSVSS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- MSVSS.java	21 Feb 2002 09:41:55 -0000	1.24
  +++ MSVSS.java	5 Mar 2002 07:54:00 -0000	1.25
  @@ -32,7 +32,6 @@
   public abstract class MSVSS
       extends AbstractTask
   {
  -
       /**
        * Constant for the thing to execute
        */
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>