Browse Source

Make variables private with protected accessors

PR:	16910
Submitted by:	Jesse Stockall


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274030 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 22 years ago
parent
commit
f25d3801bb
9 changed files with 157 additions and 83 deletions
  1. +98
    -20
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  2. +8
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java
  3. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
  4. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java
  6. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java
  7. +11
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
  8. +17
    -22
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java
  9. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java

+ 98
- 20
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -93,43 +93,43 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
private String m_serverPath = null; private String m_serverPath = null;


/** Version */ /** Version */
protected String m_Version = null;
private String m_Version = null;
/** Date */ /** Date */
protected String m_Date = null;
private String m_Date = null;
/** Label */ /** Label */
protected String m_Label = null;
private String m_Label = null;
/** Auto response */ /** Auto response */
protected String m_AutoResponse = null;
private String m_AutoResponse = null;
/** Local path */ /** Local path */
protected String m_LocalPath = null;
private String m_LocalPath = null;
/** Comment */ /** Comment */
protected String m_Comment = null;
private String m_Comment = null;
/** From label */ /** From label */
protected String m_FromLabel = null;
private String m_FromLabel = null;
/** To label */ /** To label */
protected String m_ToLabel = null;
private String m_ToLabel = null;
/** Output file name */ /** Output file name */
protected String m_OutputFileName = null;
private String m_OutputFileName = null;
/** User */ /** User */
protected String m_User = null;
private String m_User = null;
/** From date */ /** From date */
protected String m_FromDate = null;
private String m_FromDate = null;
/** To date */ /** To date */
protected String m_ToDate = null;
private String m_ToDate = null;
/** History style */ /** History style */
protected String m_Style = null;
private String m_Style = null;
/** Quiet defaults to false */ /** Quiet defaults to false */
protected boolean m_Quiet = false;
private boolean m_Quiet = false;
/** Recursive defaults to false */ /** Recursive defaults to false */
protected boolean m_Recursive = false;
private boolean m_Recursive = false;
/** Writable defaults to false */ /** Writable defaults to false */
protected boolean m_Writable = false;
private boolean m_Writable = false;
/** Fail on error defaults to true */ /** Fail on error defaults to true */
protected boolean m_FailOnError = true;
private boolean m_FailOnError = true;
/** Number of days offset for History */ /** Number of days offset for History */
protected int m_NumDays = Integer.MIN_VALUE;
private int m_NumDays = Integer.MIN_VALUE;
/** Date format for History */ /** 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 * Each sub-class must implemnt this method and return the constructed
@@ -214,12 +214,90 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
} }
} }


// 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" * Gets the sscommand string. "ss" or "c:\path\to\ss"
* *
* @return The path to ss.exe or just ss if sscommand is not set. * @return The path to ss.exe or just ss if sscommand is not set.
*/ */
public String getSSCommand() {
protected String getSSCommand() {
if (m_SSDir == null) { if (m_SSDir == null) {
return SS_EXE; return SS_EXE;
} }


+ 8
- 6
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java View File

@@ -69,6 +69,8 @@ import org.apache.tools.ant.types.Path;
*/ */
public class MSVSSADD extends MSVSS { public class MSVSSADD extends MSVSS {


private String m_LocalPath = null;

/** /**
* Builds a command line to execute ss. * Builds a command line to execute ss.
* @return The constructed commandline. * @return The constructed commandline.
@@ -119,15 +121,15 @@ public class MSVSSADD extends MSVSS {
* @param recursive The boolean value for recursive. * @param recursive The boolean value for recursive.
*/ */
public void setRecursive(boolean recursive) { public void setRecursive(boolean recursive) {
m_Recursive = recursive;
super.setInternalRecursive(recursive);
} }


/** /**
* Leave checked in files writable? Default: false. * 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 @@ public class MSVSSADD extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response){ public void setAutoresponse(String response){
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }


/** /**
@@ -148,7 +150,7 @@ public class MSVSSADD extends MSVSS {
* @param comment The comment to apply in SourceSafe * @param comment The comment to apply in SourceSafe
*/ */
public void setComment(String comment) { public void setComment(String comment) {
m_Comment = comment;
super.setInternalComment(comment);
} }


/** /**


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java View File

@@ -113,7 +113,7 @@ public class MSVSSCHECKIN extends MSVSS {
* @param localPath The path on disk. * @param localPath The path on disk.
*/ */
public void setLocalpath(Path localPath) { public void setLocalpath(Path localPath) {
m_LocalPath = localPath.toString();
super.setInternalLocalPath(localPath.toString());
} }


/** /**
@@ -122,15 +122,15 @@ public class MSVSSCHECKIN extends MSVSS {
* @param recursive The boolean value for recursive. * @param recursive The boolean value for recursive.
*/ */
public void setRecursive(boolean 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 * 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 @@ public class MSVSSCHECKIN extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response){ public void setAutoresponse(String response){
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }


/** /**
@@ -151,6 +151,6 @@ public class MSVSSCHECKIN extends MSVSS {
* @param comment The comment to apply in SourceSafe * @param comment The comment to apply in SourceSafe
*/ */
public void setComment(String comment) { public void setComment(String comment) {
m_Comment = comment;
super.setInternalComment(comment);
} }
} }

+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java View File

@@ -113,7 +113,7 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param localPath The path on disk. * @param localPath The path on disk.
*/ */
public void setLocalpath(Path localPath) { public void setLocalpath(Path localPath) {
m_LocalPath = localPath.toString();
super.setInternalLocalPath(localPath.toString());
} }


/** /**
@@ -122,7 +122,7 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param recursive The boolean value for recursive. * @param recursive The boolean value for recursive.
*/ */
public void setRecursive(boolean recursive) { public void setRecursive(boolean recursive) {
m_Recursive = recursive;
super.setInternalRecursive(recursive);
} }


/** /**
@@ -130,7 +130,7 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param version The version to checkout. * @param version The version to checkout.
*/ */
public void setVersion(String version) { public void setVersion(String version) {
m_Version = version;
super.setInternalVersion(version);
} }


/** /**
@@ -138,7 +138,7 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param date The date to checkout. * @param date The date to checkout.
*/ */
public void setDate(String date) { public void setDate(String date) {
m_Date = date;
super.setInternalDate(date);
} }


/** /**
@@ -146,7 +146,7 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param label The label to apply. * @param label The label to apply.
*/ */
public void setLabel(String label) { public void setLabel(String label) {
m_Label = label;
super.setInternalLabel(label);
} }


/** /**
@@ -156,6 +156,6 @@ public class MSVSSCHECKOUT extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response){ public void setAutoresponse(String response){
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }
} }

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java View File

@@ -105,6 +105,6 @@ public class MSVSSCP extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response) { public void setAutoresponse(String response) {
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }
} }

+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java View File

@@ -156,7 +156,7 @@ public class MSVSSCREATE extends MSVSS {
* @param comment The comment to apply in SourceSafe * @param comment The comment to apply in SourceSafe
*/ */
public void setComment(String comment) { public void setComment(String comment) {
m_Comment = comment;
super.setInternalComment(comment);
} }


/** /**
@@ -164,16 +164,16 @@ public class MSVSSCREATE extends MSVSS {
* @param quiet The boolean value for quiet. * @param quiet The boolean value for quiet.
*/ */
public final void setQuiet (boolean 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 * 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. * @param failOnError True if task should fail on any error.
*/ */
public final void setFailOnError (boolean failOnError) { public final void setFailOnError (boolean failOnError) {
m_FailOnError = failOnError;
super.setInternalFailOnError(failOnError);
} }


/** /**
@@ -183,6 +183,6 @@ public class MSVSSCREATE extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response) { public void setAutoresponse(String response) {
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }
} }

+ 11
- 12
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java View File

@@ -54,7 +54,6 @@


package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.File;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -175,7 +174,7 @@ public class MSVSSGET extends MSVSS {
* @param localPath The path on disk. * @param localPath The path on disk.
*/ */
public void setLocalpath(Path localPath) { public void setLocalpath(Path localPath) {
m_LocalPath = localPath.toString();
super.setInternalLocalPath(localPath.toString());
} }


/** /**
@@ -184,7 +183,7 @@ public class MSVSSGET extends MSVSS {
* @param recursive The boolean value for recursive. * @param recursive The boolean value for recursive.
*/ */
public final void setRecursive(boolean recursive) { public final void setRecursive(boolean recursive) {
m_Recursive = recursive;
super.setInternalRecursive(recursive);
} }


/** /**
@@ -192,15 +191,15 @@ public class MSVSSGET extends MSVSS {
* @param quiet The boolean value for quiet. * @param quiet The boolean value for quiet.
*/ */
public final void setQuiet (boolean 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 @@ public class MSVSSGET extends MSVSS {
* @param version The version to get. * @param version The version to get.
*/ */
public void setVersion(String version) { public void setVersion(String version) {
m_Version = version;
super.setInternalVersion(version);
} }


/** /**
@@ -216,7 +215,7 @@ public class MSVSSGET extends MSVSS {
* @param date The date to checkout. * @param date The date to checkout.
*/ */
public void setDate(String date) { public void setDate(String date) {
m_Date = date;
super.setInternalDate(date);
} }


/** /**
@@ -224,7 +223,7 @@ public class MSVSSGET extends MSVSS {
* @param label The label to apply. * @param label The label to apply.
*/ */
public void setLabel(String label) { public void setLabel(String label) {
m_Label = label;
super.setInternalLabel(label);
} }


/** /**
@@ -234,6 +233,6 @@ public class MSVSSGET extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response){ public void setAutoresponse(String response){
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }
} }

+ 17
- 22
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java View File

@@ -55,15 +55,12 @@
package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.File; import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; 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.BuildException;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;

/** /**
* Performs History commands to Microsoft Visual SourceSafe. * Performs History commands to Microsoft Visual SourceSafe.
* *
@@ -120,7 +117,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param recursive The boolean value for recursive. * @param recursive The boolean value for recursive.
*/ */
public void setRecursive(boolean recursive) { public void setRecursive(boolean recursive) {
m_Recursive = recursive;
super.setInternalRecursive(recursive);
} }


/** /**
@@ -128,7 +125,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param user The username. * @param user The username.
*/ */
public void setUser(String user) { public void setUser(String user) {
m_User = user;
super.setInternalUser(user);
} }


/** /**
@@ -137,7 +134,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param fromDate The start date. * @param fromDate The start date.
*/ */
public void setFromDate(String fromDate) { public void setFromDate(String fromDate) {
m_FromDate = fromDate;
super.setInternalFromDate(fromDate);
} }


/** /**
@@ -145,7 +142,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param toDate The end date. * @param toDate The end date.
*/ */
public void setToDate(String toDate) { public void setToDate(String toDate) {
m_ToDate = toDate;
super.setInternalToDate(toDate);
} }


/** /**
@@ -153,7 +150,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param fromLabel The start label. * @param fromLabel The start label.
*/ */
public void setFromLabel(String fromLabel) { public void setFromLabel(String fromLabel) {
m_FromLabel = fromLabel;
super.setInternalFromLabel(fromLabel);
} }


/** /**
@@ -161,7 +158,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param toLabel The end label. * @param toLabel The end label.
*/ */
public void setToLabel(String toLabel) { public void setToLabel(String toLabel) {
m_ToLabel = toLabel;
super.setInternalToLabel(toLabel);
} }


/** /**
@@ -172,7 +169,7 @@ public class MSVSSHISTORY extends MSVSS {
* @param numd The number of days. * @param numd The number of days.
*/ */
public void setNumdays(int numd) { public void setNumdays(int numd) {
m_NumDays = numd;
super.setInternalNumDays(numd);
} }


/** /**
@@ -180,10 +177,8 @@ public class MSVSSHISTORY extends MSVSS {
* @param outfile The output file name. * @param outfile The output file name.
*/ */
public void setOutput(File outfile) { 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 @@ public class MSVSSHISTORY extends MSVSS {
* @param dateFormat The date format. * @param dateFormat The date format.
*/ */
public void setDateFormat(String dateFormat) { public void setDateFormat(String dateFormat) {
m_DateFormat = new SimpleDateFormat(dateFormat);
super.setInternalDateFormat(new SimpleDateFormat(dateFormat));
} }


/** /**
@@ -213,15 +208,15 @@ public class MSVSSHISTORY extends MSVSS {
public void setStyle(BriefCodediffNofile attr) { public void setStyle(BriefCodediffNofile attr) {
String option = attr.getValue(); String option = attr.getValue();
if (option.equals(STYLE_BRIEF)) { if (option.equals(STYLE_BRIEF)) {
m_Style = FLAG_BRIEF;
super.setInternalStyle(FLAG_BRIEF);
} else if (option.equals(STYLE_CODEDIFF)) { } else if (option.equals(STYLE_CODEDIFF)) {
m_Style = FLAG_CODEDIFF;
super.setInternalStyle(FLAG_CODEDIFF);
} else if (option.equals(STYLE_DEFAULT)) { } else if (option.equals(STYLE_DEFAULT)) {
m_Style = "";
super.setInternalStyle("");
} else if (option.equals(STYLE_NOFILE)) { } else if (option.equals(STYLE_NOFILE)) {
m_Style = FLAG_NO_FILE;
super.setInternalStyle(FLAG_NO_FILE);
} else { } else {
throw new BuildException("Style " + attr + " unknown.");
throw new BuildException("Style " + attr + " unknown.", getLocation());
} }
} }




+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java View File

@@ -158,7 +158,7 @@ public class MSVSSLABEL extends MSVSS {
* @param label The label to apply. * @param label The label to apply.
*/ */
public void setLabel(String label) { public void setLabel(String label) {
m_Label = label;
super.setInternalLabel(label);
} }


/** /**
@@ -166,7 +166,7 @@ public class MSVSSLABEL extends MSVSS {
* @param version The version to label. * @param version The version to label.
*/ */
public void setVersion(String version) { public void setVersion(String version) {
m_Version = version;
super.setInternalVersion(version);
} }


/** /**
@@ -175,7 +175,7 @@ public class MSVSSLABEL extends MSVSS {
* @param comment The comment to apply in SourceSafe * @param comment The comment to apply in SourceSafe
*/ */
public void setComment(String comment) { public void setComment(String comment) {
m_Comment = comment;
super.setInternalComment(comment);
} }


/** /**
@@ -185,6 +185,6 @@ public class MSVSSLABEL extends MSVSS {
* @param response The auto response value. * @param response The auto response value.
*/ */
public void setAutoresponse(String response){ public void setAutoresponse(String response){
m_AutoResponse = response;
super.setInternalAutoResponse(response);
} }
} }

Loading…
Cancel
Save