conor 2003/02/10 02:32:34
Modified: src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSS.java MSVSSADD.java MSVSSCHECKIN.java MSVSSCHECKOUT.java MSVSSCP.java MSVSSCREATE.java MSVSSGET.java MSVSSHISTORY.java MSVSSLABEL.java Log: Make variables private with protected accessors PR: 16910 Submitted by: Jesse Stockall Revision Changes Path 1.27 +98 -20 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java Index: MSVSS.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -u -r1.26 -r1.27 --- MSVSS.java 9 Feb 2003 12:59:12 -0000 1.26 +++ MSVSS.java 10 Feb 2003 10:32:34 -0000 1.27 @@ -93,43 +93,43 @@ private String m_serverPath = null; /** Version */ - protected String m_Version = null; + private String m_Version = null; /** Date */ - protected String m_Date = null; + private String m_Date = null; /** Label */ - protected String m_Label = null; + private String m_Label = null; /** Auto response */ - protected String m_AutoResponse = null; + private String m_AutoResponse = null; /** Local path */ - protected String m_LocalPath = null; + private String m_LocalPath = null; /** Comment */ - protected String m_Comment = null; + private String m_Comment = null; /** From label */ - protected String m_FromLabel = null; + private String m_FromLabel = null; /** To label */ - protected String m_ToLabel = null; + private String m_ToLabel = null; /** Output file name */ - protected String m_OutputFileName = null; + private String m_OutputFileName = null; /** User */ - protected String m_User = null; + private String m_User = null; /** From date */ - protected String m_FromDate = null; + private String m_FromDate = null; /** To date */ - protected String m_ToDate = null; + private String m_ToDate = null; /** History style */ - protected String m_Style = null; + private String m_Style = null; /** Quiet defaults to false */ - protected boolean m_Quiet = false; + private boolean m_Quiet = false; /** Recursive defaults to false */ - protected boolean m_Recursive = false; + private boolean m_Recursive = false; /** Writable defaults to false */ - protected boolean m_Writable = false; + private boolean m_Writable = false; /** Fail on error defaults to true */ - protected boolean m_FailOnError = true; + private boolean m_FailOnError = true; /** Number of days offset for History */ - protected int m_NumDays = Integer.MIN_VALUE; + private int m_NumDays = Integer.MIN_VALUE; /** Date format for History */ - protected DateFormat m_DateFormat = DateFormat.getDateInstance(DateFormat.SHORT); + private DateFormat m_DateFormat = DateFormat.getDateInstance(DateFormat.SHORT); /** * Each sub-class must implemnt this method and return the constructed @@ -214,12 +214,90 @@ } } + // Special setters for the sub-classes + + protected void setInternalComment(String text) { + m_Comment = text; + } + + protected void setInternalAutoResponse(String text) { + m_AutoResponse = text; + } + + protected void setInternalDate(String text) { + m_Date = text; + } + + protected void setInternalDateFormat(DateFormat date) { + m_DateFormat = date; + } + + protected void setInternalFailOnError(boolean fail) { + m_FailOnError = fail; + } + + protected void setInternalFromDate(String text) { + m_FromDate = text; + } + + protected void setInternalFromLabel(String text) { + m_FromLabel = text; + } + + protected void setInternalLabel(String text) { + m_Label = text; + } + + protected void setInternalLocalPath(String text) { + m_LocalPath = text; + } + + protected void setInternalNumDays(int days) { + m_NumDays = days; + } + + protected void setInternalOutputFilename(String text) { + m_OutputFileName = text; + } + + protected void setInternalQuiet(boolean quiet) { + m_Quiet = quiet; + } + + protected void setInternalRecursive(boolean recursive) { + m_Recursive = recursive; + } + + protected void setInternalStyle(String style) { + m_Style = style; + } + + protected void setInternalToDate(String text) { + m_ToDate = text; + } + + protected void setInternalToLabel(String text) { + m_ToLabel = text; + } + + protected void setInternalUser(String user) { + m_User = user; + } + + protected void setInternalVersion(String text) { + m_Version = text; + } + + protected void setInternalWritable(boolean writable) { + m_Writable = writable; + } + /** * Gets the sscommand string. "ss" or "c:\path\to\ss" * * @return The path to ss.exe or just ss if sscommand is not set. */ - public String getSSCommand() { + protected String getSSCommand() { if (m_SSDir == null) { return SS_EXE; } 1.9 +8 -6 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java Index: MSVSSADD.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -u -r1.8 -r1.9 --- MSVSSADD.java 9 Feb 2003 12:59:12 -0000 1.8 +++ MSVSSADD.java 10 Feb 2003 10:32:34 -0000 1.9 @@ -69,6 +69,8 @@ */ public class MSVSSADD extends MSVSS { + private String m_LocalPath = null; + /** * Builds a command line to execute ss. * @return The constructed commandline. @@ -119,15 +121,15 @@ * @param recursive The boolean value for recursive. */ public void setRecursive(boolean recursive) { - m_Recursive = recursive; + super.setInternalRecursive(recursive); } /** * Leave checked in files writable? Default: false. - * @param argWritable The boolean value for writable. + * @param writable The boolean value for writable. */ - public final void setWritable(boolean argWritable) { - m_Writable = argWritable; + public final void setWritable(boolean writable) { + super.setInternalWritable(writable); } /** @@ -137,7 +139,7 @@ * @param response The auto response value. */ public void setAutoresponse(String response){ - m_AutoResponse = response; + super.setInternalAutoResponse(response); } /** @@ -148,7 +150,7 @@ * @param comment The comment to apply in SourceSafe */ public void setComment(String comment) { - m_Comment = comment; + super.setInternalComment(comment); } /** 1.15 +7 -7 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java Index: MSVSSCHECKIN.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -u -r1.14 -r1.15 --- MSVSSCHECKIN.java 9 Feb 2003 12:59:12 -0000 1.14 +++ MSVSSCHECKIN.java 10 Feb 2003 10:32:34 -0000 1.15 @@ -113,7 +113,7 @@ * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { - m_LocalPath = localPath.toString(); + super.setInternalLocalPath(localPath.toString()); } /** @@ -122,15 +122,15 @@ * @param recursive The boolean value for recursive. */ public void setRecursive(boolean recursive) { - m_Recursive = recursive; + super.setInternalRecursive(recursive); } /** * Sets behaviour, unset the READ-ONLY flag on files checkedin to VSS.; optional - * @param argWritable The boolean value for writable. + * @param writable The boolean value for writable. */ - public final void setWritable(boolean argWritable) { - m_Writable = argWritable; + public final void setWritable(boolean writable) { + super.setInternalWritable(writable); } /** @@ -140,7 +140,7 @@ * @param response The auto response value. */ public void setAutoresponse(String response){ - m_AutoResponse = response; + super.setInternalAutoResponse(response); } /** @@ -151,6 +151,6 @@ * @param comment The comment to apply in SourceSafe */ public void setComment(String comment) { - m_Comment = comment; + super.setInternalComment(comment); } } 1.14 +6 -6 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java Index: MSVSSCHECKOUT.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -u -r1.13 -r1.14 --- MSVSSCHECKOUT.java 9 Feb 2003 12:59:12 -0000 1.13 +++ MSVSSCHECKOUT.java 10 Feb 2003 10:32:34 -0000 1.14 @@ -113,7 +113,7 @@ * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { - m_LocalPath = localPath.toString(); + super.setInternalLocalPath(localPath.toString()); } /** @@ -122,7 +122,7 @@ * @param recursive The boolean value for recursive. */ public void setRecursive(boolean recursive) { - m_Recursive = recursive; + super.setInternalRecursive(recursive); } /** @@ -130,7 +130,7 @@ * @param version The version to checkout. */ public void setVersion(String version) { - m_Version = version; + super.setInternalVersion(version); } /** @@ -138,7 +138,7 @@ * @param date The date to checkout. */ public void setDate(String date) { - m_Date = date; + super.setInternalDate(date); } /** @@ -146,7 +146,7 @@ * @param label The label to apply. */ public void setLabel(String label) { - m_Label = label; + super.setInternalLabel(label); } /** @@ -156,6 +156,6 @@ * @param response The auto response value. */ public void setAutoresponse(String response){ - m_AutoResponse = response; + super.setInternalAutoResponse(response); } } 1.7 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java Index: MSVSSCP.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -u -r1.6 -r1.7 --- MSVSSCP.java 9 Feb 2003 12:59:12 -0000 1.6 +++ MSVSSCP.java 10 Feb 2003 10:32:34 -0000 1.7 @@ -105,6 +105,6 @@ * @param response The auto response value. */ public void setAutoresponse(String response) { - m_AutoResponse = response; + super.setInternalAutoResponse(response); } } 1.8 +5 -5 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java Index: MSVSSCREATE.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -u -r1.7 -r1.8 --- MSVSSCREATE.java 9 Feb 2003 12:59:12 -0000 1.7 +++ MSVSSCREATE.java 10 Feb 2003 10:32:34 -0000 1.8 @@ -156,7 +156,7 @@ * @param comment The comment to apply in SourceSafe */ public void setComment(String comment) { - m_Comment = comment; + super.setInternalComment(comment); } /** @@ -164,16 +164,16 @@ * @param quiet The boolean value for quiet. */ public final void setQuiet (boolean quiet) { - m_Quiet = quiet; + super.setInternalQuiet(quiet); } /** * Sets behaviour, whether task should fail if there is an error creating - * the project.; optional. + * the project.; optional, default true * @param failOnError True if task should fail on any error. */ public final void setFailOnError (boolean failOnError) { - m_FailOnError = failOnError; + super.setInternalFailOnError(failOnError); } /** @@ -183,6 +183,6 @@ * @param response The auto response value. */ public void setAutoresponse(String response) { - m_AutoResponse = response; + super.setInternalAutoResponse(response); } } 1.23 +11 -12 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java Index: MSVSSGET.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -u -r1.22 -r1.23 --- MSVSSGET.java 9 Feb 2003 12:59:12 -0000 1.22 +++ MSVSSGET.java 10 Feb 2003 10:32:34 -0000 1.23 @@ -54,7 +54,6 @@ package org.apache.tools.ant.taskdefs.optional.vss; -import java.io.File; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -175,7 +174,7 @@ * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { - m_LocalPath = localPath.toString(); + super.setInternalLocalPath(localPath.toString()); } /** @@ -184,7 +183,7 @@ * @param recursive The boolean value for recursive. */ public final void setRecursive(boolean recursive) { - m_Recursive = recursive; + super.setInternalRecursive(recursive); } /** @@ -192,15 +191,15 @@ * @param quiet The boolean value for quiet. */ public final void setQuiet (boolean quiet) { - m_Quiet = quiet; + super.setInternalQuiet(quiet); } /** - * Sets behaviour, unset the READ-ONLY flag on files retrieved from VSS.; optional - * @param argWritable The boolean value for writable. + * Sets behaviour, unset the READ-ONLY flag on files retrieved from VSS.; optional, default false + * @param writable The boolean value for writable. */ - public final void setWritable(boolean argWritable) { - m_Writable = argWritable; + public final void setWritable(boolean writable) { + super.setInternalWritable(writable); } /** @@ -208,7 +207,7 @@ * @param version The version to get. */ public void setVersion(String version) { - m_Version = version; + super.setInternalVersion(version); } /** @@ -216,7 +215,7 @@ * @param date The date to checkout. */ public void setDate(String date) { - m_Date = date; + super.setInternalDate(date); } /** @@ -224,7 +223,7 @@ * @param label The label to apply. */ public void setLabel(String label) { - m_Label = label; + super.setInternalLabel(label); } /** @@ -234,6 +233,6 @@ * @param response The auto response value. */ public void setAutoresponse(String response){ - m_AutoResponse = response; + super.setInternalAutoResponse(response); } } 1.15 +17 -22 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java Index: MSVSSHISTORY.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -u -r1.14 -r1.15 --- MSVSSHISTORY.java 9 Feb 2003 12:59:13 -0000 1.14 +++ MSVSSHISTORY.java 10 Feb 2003 10:32:34 -0000 1.15 @@ -55,15 +55,12 @@ package org.apache.tools.ant.taskdefs.optional.vss; import java.io.File; -import java.text.DateFormat; -import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.EnumeratedAttribute; + /** * Performs History commands to Microsoft Visual SourceSafe. * @@ -120,7 +117,7 @@ * @param recursive The boolean value for recursive. */ public void setRecursive(boolean recursive) { - m_Recursive = recursive; + super.setInternalRecursive(recursive); } /** @@ -128,7 +125,7 @@ * @param user The username. */ public void setUser(String user) { - m_User = user; + super.setInternalUser(user); } /** @@ -137,7 +134,7 @@ * @param fromDate The start date. */ public void setFromDate(String fromDate) { - m_FromDate = fromDate; + super.setInternalFromDate(fromDate); } /** @@ -145,7 +142,7 @@ * @param toDate The end date. */ public void setToDate(String toDate) { - m_ToDate = toDate; + super.setInternalToDate(toDate); } /** @@ -153,7 +150,7 @@ * @param fromLabel The start label. */ public void setFromLabel(String fromLabel) { - m_FromLabel = fromLabel; + super.setInternalFromLabel(fromLabel); } /** @@ -161,7 +158,7 @@ * @param toLabel The end label. */ public void setToLabel(String toLabel) { - m_ToLabel = toLabel; + super.setInternalToLabel(toLabel); } /** @@ -172,7 +169,7 @@ * @param numd The number of days. */ public void setNumdays(int numd) { - m_NumDays = numd; + super.setInternalNumDays(numd); } /** @@ -180,10 +177,8 @@ * @param outfile The output file name. */ public void setOutput(File outfile) { - if (outfile == null) { - m_OutputFileName = null; - } else { - m_OutputFileName = outfile.getAbsolutePath(); + if (outfile != null) { + super.setInternalOutputFilename(outfile.getAbsolutePath()); } } @@ -196,7 +191,7 @@ * @param dateFormat The date format. */ public void setDateFormat(String dateFormat) { - m_DateFormat = new SimpleDateFormat(dateFormat); + super.setInternalDateFormat(new SimpleDateFormat(dateFormat)); } /** @@ -213,15 +208,15 @@ public void setStyle(BriefCodediffNofile attr) { String option = attr.getValue(); if (option.equals(STYLE_BRIEF)) { - m_Style = FLAG_BRIEF; + super.setInternalStyle(FLAG_BRIEF); } else if (option.equals(STYLE_CODEDIFF)) { - m_Style = FLAG_CODEDIFF; + super.setInternalStyle(FLAG_CODEDIFF); } else if (option.equals(STYLE_DEFAULT)) { - m_Style = ""; + super.setInternalStyle(""); } else if (option.equals(STYLE_NOFILE)) { - m_Style = FLAG_NO_FILE; + super.setInternalStyle(FLAG_NO_FILE); } else { - throw new BuildException("Style " + attr + " unknown."); + throw new BuildException("Style " + attr + " unknown.", getLocation()); } } 1.15 +4 -4 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java Index: MSVSSLABEL.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -u -r1.14 -r1.15 --- MSVSSLABEL.java 9 Feb 2003 12:59:13 -0000 1.14 +++ MSVSSLABEL.java 10 Feb 2003 10:32:34 -0000 1.15 @@ -158,7 +158,7 @@ * @param label The label to apply. */ public void setLabel(String label) { - m_Label = label; + super.setInternalLabel(label); } /** @@ -166,7 +166,7 @@ * @param version The version to label. */ public void setVersion(String version) { - m_Version = version; + super.setInternalVersion(version); } /** @@ -175,7 +175,7 @@ * @param comment The comment to apply in SourceSafe */ public void setComment(String comment) { - m_Comment = comment; + super.setInternalComment(comment); } /** @@ -185,6 +185,6 @@ * @param response The auto response value. */ public void setAutoresponse(String response){ - m_AutoResponse = response; + super.setInternalAutoResponse(response); } }