Browse Source

javadoc

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@473822 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
9288b2c715
3 changed files with 77 additions and 25 deletions
  1. +5
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
  2. +17
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  3. +55
    -20
      src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java

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

@@ -48,6 +48,7 @@ public class Native2Ascii extends MatchingTask {
private Mapper mapper; private Mapper mapper;
private FacadeTaskHelper facade = null; private FacadeTaskHelper facade = null;


/** No args constructor */
public Native2Ascii() { public Native2Ascii() {
facade = new FacadeTaskHelper(Native2AsciiAdapterFactory.getDefault()); facade = new FacadeTaskHelper(Native2AsciiAdapterFactory.getDefault());
} }
@@ -65,7 +66,7 @@ public class Native2Ascii extends MatchingTask {


/** /**
* The value of the reverse attribute. * The value of the reverse attribute.
*
* @return the reverse attribute.
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
public boolean getReverse() { public boolean getReverse() {
@@ -84,8 +85,8 @@ public class Native2Ascii extends MatchingTask {
} }


/** /**
* The value of the reverse attribute.
*
* The value of the encoding attribute.
* @return the encoding attribute.
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
public String getEncoding() { public String getEncoding() {
@@ -272,7 +273,7 @@ public class Native2Ascii extends MatchingTask {
/** /**
* Returns the (implementation specific) settings given as nested * Returns the (implementation specific) settings given as nested
* arg elements. * arg elements.
*
* @return the arguments.
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
public String[] getCurrentArgs() { public String[] getCurrentArgs() {


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

@@ -131,6 +131,10 @@ public class PropertyFile extends Task {
* Methods * Methods
*/ */


/**
* Execute the task.
* @throws BuildException on error.
*/
public void execute() throws BuildException { public void execute() throws BuildException {
checkParameters(); checkParameters();
readFile(); readFile();
@@ -138,6 +142,10 @@ public class PropertyFile extends Task {
writeFile(); writeFile();
} }


/**
* The entry nested element.
* @return an entry nested element to be configured.
*/
public Entry createEntry() { public Entry createEntry() {
Entry e = new Entry(); Entry e = new Entry();
entries.addElement(e); entries.addElement(e);
@@ -194,6 +202,7 @@ public class PropertyFile extends Task {


/** /**
* Location of the property file to be edited; required. * Location of the property file to be edited; required.
* @param file the property file.
*/ */
public void setFile(File file) { public void setFile(File file) {
propertyfile = file; propertyfile = file;
@@ -201,6 +210,7 @@ public class PropertyFile extends Task {


/** /**
* optional header comment for the file * optional header comment for the file
* @param hdr the string to use for the comment.
*/ */
public void setComment(String hdr) { public void setComment(String hdr) {
comment = hdr; comment = hdr;
@@ -242,6 +252,7 @@ public class PropertyFile extends Task {


/** /**
* Name of the property name/value pair * Name of the property name/value pair
* @param value the key.
*/ */
public void setKey(String value) { public void setKey(String value) {
this.key = value; this.key = value;
@@ -249,6 +260,7 @@ public class PropertyFile extends Task {


/** /**
* Value to set (=), to add (+) or subtract (-) * Value to set (=), to add (+) or subtract (-)
* @param value the value.
*/ */
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
@@ -258,6 +270,7 @@ public class PropertyFile extends Task {
* operation to apply. * operation to apply.
* "+" or "=" * "+" or "="
*(default) for all datatypes; "-" for date and int only)\. *(default) for all datatypes; "-" for date and int only)\.
* @param value the operation enumerated value.
*/ */
public void setOperation(Operation value) { public void setOperation(Operation value) {
this.operation = Operation.toOperation(value.getValue()); this.operation = Operation.toOperation(value.getValue());
@@ -265,6 +278,7 @@ public class PropertyFile extends Task {


/** /**
* Regard the value as : int, date or string (default) * Regard the value as : int, date or string (default)
* @param value the type enumerated value.
*/ */
public void setType(Type value) { public void setType(Type value) {
this.type = Type.toType(value.getValue()); this.type = Type.toType(value.getValue());
@@ -274,8 +288,8 @@ public class PropertyFile extends Task {
* Initial value to set for a property if it is not * Initial value to set for a property if it is not
* already defined in the property file. * already defined in the property file.
* For type date, an additional keyword is allowed: "now" * For type date, an additional keyword is allowed: "now"
* @param value the default value.
*/ */

public void setDefault(String value) { public void setDefault(String value) {
this.defaultValue = value; this.defaultValue = value;
} }
@@ -283,6 +297,7 @@ public class PropertyFile extends Task {
/** /**
* For int and date type only. If present, Values will * For int and date type only. If present, Values will
* be parsed and formatted accordingly. * be parsed and formatted accordingly.
* @param value the pattern to use.
*/ */
public void setPattern(String value) { public void setPattern(String value) {
this.pattern = value; this.pattern = value;
@@ -302,6 +317,7 @@ public class PropertyFile extends Task {
* <li>year</li> * <li>year</li>
* </ul> * </ul>
* This only applies to date types using a +/- operation. * This only applies to date types using a +/- operation.
* @param unit the unit enumerated value.
* @since Ant 1.5 * @since Ant 1.5
*/ */
public void setUnit(PropertyFile.Unit unit) { public void setUnit(PropertyFile.Unit unit) {


+ 55
- 20
src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java View File

@@ -21,7 +21,6 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.XmlConstants; import org.apache.tools.ant.util.XmlConstants;
import org.apache.tools.ant.util.JAXPUtils;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXNotSupportedException;
@@ -65,17 +64,28 @@ public class SchemaValidate extends XMLValidateTask {
*/ */
private SchemaLocation anonymousSchema; private SchemaLocation anonymousSchema;


// Error strings
/** SAX1 not supported */
public static final String ERROR_SAX_1 = "SAX1 parsers are not supported"; public static final String ERROR_SAX_1 = "SAX1 parsers are not supported";


public static final String ERROR_NO_XSD_SUPPORT = "Parser does not support Xerces or JAXP schema features";
/** schema features not supported */
public static final String ERROR_NO_XSD_SUPPORT
= "Parser does not support Xerces or JAXP schema features";


public static final String ERROR_TOO_MANY_DEFAULT_SCHEMAS = "Only one of defaultSchemaFile and defaultSchemaURL allowed";
/** too many default schemas */
public static final String ERROR_TOO_MANY_DEFAULT_SCHEMAS
= "Only one of defaultSchemaFile and defaultSchemaURL allowed";


public static final String ERROR_PARSER_CREATION_FAILURE = "Could not create parser";
/** unable to create parser */
public static final String ERROR_PARSER_CREATION_FAILURE
= "Could not create parser";


/** adding schema */
public static final String MESSAGE_ADDING_SCHEMA = "Adding schema "; public static final String MESSAGE_ADDING_SCHEMA = "Adding schema ";


public static final String ERROR_DUPLICATE_SCHEMA = "Duplicate declaration of schema ";
/** Duplicate declaration of schema */
public static final String ERROR_DUPLICATE_SCHEMA
= "Duplicate declaration of schema ";


/** /**
* Called by the project to let the task initialize properly. The default * Called by the project to let the task initialize properly. The default
@@ -137,7 +147,7 @@ public class SchemaValidate extends XMLValidateTask {


/** /**
* add the schema * add the schema
* @param location
* @param location the schema location.
* @throws BuildException if there is no namespace, or if there already * @throws BuildException if there is no namespace, or if there already
* is a declaration of this schema with a different value * is a declaration of this schema with a different value
*/ */
@@ -153,7 +163,7 @@ public class SchemaValidate extends XMLValidateTask {


/** /**
* enable full schema checking. Slower but better. * enable full schema checking. Slower but better.
* @param fullChecking
* @param fullChecking a <code>boolean</code> value.
*/ */
public void setFullChecking(boolean fullChecking) { public void setFullChecking(boolean fullChecking) {
this.fullChecking = fullChecking; this.fullChecking = fullChecking;
@@ -172,7 +182,7 @@ public class SchemaValidate extends XMLValidateTask {


/** /**
* identify the URL of the default schema * identify the URL of the default schema
* @param defaultSchemaURL
* @param defaultSchemaURL the URL of the default schema.
*/ */
public void setNoNamespaceURL(String defaultSchemaURL) { public void setNoNamespaceURL(String defaultSchemaURL) {
createAnonymousSchema(); createAnonymousSchema();
@@ -181,7 +191,7 @@ public class SchemaValidate extends XMLValidateTask {


/** /**
* identify a file containing the default schema * identify a file containing the default schema
* @param defaultSchemaFile
* @param defaultSchemaFile the location of the default schema.
*/ */
public void setNoNamespaceFile(File defaultSchemaFile) { public void setNoNamespaceFile(File defaultSchemaFile) {
createAnonymousSchema(); createAnonymousSchema();
@@ -190,7 +200,7 @@ public class SchemaValidate extends XMLValidateTask {


/** /**
* flag to disable DTD support. * flag to disable DTD support.
* @param disableDTD
* @param disableDTD a <code>boolean</code> value.
*/ */
public void setDisableDTD(boolean disableDTD) { public void setDisableDTD(boolean disableDTD) {
this.disableDTD = disableDTD; this.disableDTD = disableDTD;
@@ -288,8 +298,8 @@ public class SchemaValidate extends XMLValidateTask {
/** /**
* set a feature if it is supported, log at verbose level if * set a feature if it is supported, log at verbose level if
* not * not
* @param feature
* @param value
* @param feature the feature.
* @param value a <code>boolean</code> value.
*/ */
protected void setFeatureIfSupported(String feature, boolean value) { protected void setFeatureIfSupported(String feature, boolean value) {
try { try {
@@ -321,31 +331,48 @@ public class SchemaValidate extends XMLValidateTask {


private String url; private String url;


/** No namespace URI */
public static final String ERROR_NO_URI = "No namespace URI"; public static final String ERROR_NO_URI = "No namespace URI";


public static final String ERROR_TWO_LOCATIONS = "Both URL and File were given for schema ";
/** Both URL and File were given for schema */
public static final String ERROR_TWO_LOCATIONS
= "Both URL and File were given for schema ";


/** File not found */
public static final String ERROR_NO_FILE = "File not found: "; public static final String ERROR_NO_FILE = "File not found: ";


public static final String ERROR_NO_URL_REPRESENTATION = "Cannot make a URL of ";
/** Cannot make URL */
public static final String ERROR_NO_URL_REPRESENTATION
= "Cannot make a URL of ";


public static final String ERROR_NO_LOCATION = "No file or URL supplied for the schema ";
/** No location provided */
public static final String ERROR_NO_LOCATION
= "No file or URL supplied for the schema ";


/** No arg constructor */
public SchemaLocation() { public SchemaLocation() {
} }


/**
* Get the namespace.
* @return the namespace.
*/
public String getNamespace() { public String getNamespace() {
return namespace; return namespace;
} }


/** /**
* set the namespace of this schema. Any URI * set the namespace of this schema. Any URI
* @param namespace
* @param namespace the namespace to use.
*/ */
public void setNamespace(String namespace) { public void setNamespace(String namespace) {
this.namespace = namespace; this.namespace = namespace;
} }


/**
* Get the file.
* @return the file containing the schema.
*/
public File getFile() { public File getFile() {
return file; return file;
} }
@@ -353,19 +380,23 @@ public class SchemaValidate extends XMLValidateTask {
/** /**
* identify a file that contains this namespace's schema. * identify a file that contains this namespace's schema.
* The file must exist. * The file must exist.
* @param file
* @param file the file contains the schema.
*/ */
public void setFile(File file) { public void setFile(File file) {
this.file = file; this.file = file;
} }


/**
* The URL containing the schema.
* @return the URL string.
*/
public String getUrl() { public String getUrl() {
return url; return url;
} }


/** /**
* identify a URL that hosts the schema. * identify a URL that hosts the schema.
* @param url
* @param url the URL string.
*/ */
public void setUrl(String url) { public void setUrl(String url) {
this.url = url; this.url = url;
@@ -406,7 +437,7 @@ public class SchemaValidate extends XMLValidateTask {
* validate the fields then create a "uri location" string * validate the fields then create a "uri location" string
* *
* @return string of uri and location * @return string of uri and location
* @throws BuildException
* @throws BuildException if there is an error.
*/ */
public String getURIandLocation() throws BuildException { public String getURIandLocation() throws BuildException {
validateNamespace(); validateNamespace();
@@ -466,6 +497,10 @@ public class SchemaValidate extends XMLValidateTask {
return true; return true;
} }


/**
* Generate a hashcode depending on the namespace, url and file name.
* @return the hashcode.
*/
public int hashCode() { public int hashCode() {
int result; int result;
result = (namespace != null ? namespace.hashCode() : 0); result = (namespace != null ? namespace.hashCode() : 0);
@@ -488,4 +523,4 @@ public class SchemaValidate extends XMLValidateTask {
return buffer.toString(); return buffer.toString();
} }
} //SchemaLocation } //SchemaLocation
}
}

Loading…
Cancel
Save