git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278436 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000-2004 The Apache Software Foundation | |||
| * Copyright 2000-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -47,7 +47,8 @@ public class Tstamp extends Task { | |||
| /** | |||
| * Set a prefix for the properties. If the prefix does not end with a "." | |||
| * one is automatically added | |||
| * one is automatically added. | |||
| * @param prefix the prefix to use. | |||
| * @since Ant 1.5 | |||
| */ | |||
| public void setPrefix(String prefix) { | |||
| @@ -60,7 +61,7 @@ public class Tstamp extends Task { | |||
| /** | |||
| * create the timestamps. Custom ones are done before | |||
| * the standard ones, to get their retaliation in early. | |||
| * @throws BuildException | |||
| * @throws BuildException on error. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| try { | |||
| @@ -132,7 +133,7 @@ public class Tstamp extends Task { | |||
| /** | |||
| * The property to receive the date/time string in the given pattern | |||
| * @param propertyName | |||
| * @param propertyName the name of the property. | |||
| */ | |||
| public void setProperty(String propertyName) { | |||
| this.propertyName = propertyName; | |||
| @@ -182,7 +183,7 @@ public class Tstamp extends Task { | |||
| /** | |||
| * The timezone to use for displaying time. | |||
| * The values are as defined by the Java TimeZone class. | |||
| * @param id | |||
| * @param id the timezone value. | |||
| * @see java.util.TimeZone | |||
| */ | |||
| public void setTimezone(String id) { | |||
| @@ -191,13 +192,15 @@ public class Tstamp extends Task { | |||
| /** | |||
| * The numeric offset to the current time. | |||
| * @param offset | |||
| * @param offset the offset to use. | |||
| */ | |||
| public void setOffset(int offset) { | |||
| this.offset = offset; | |||
| } | |||
| /** | |||
| * Set the unit type (using String). | |||
| * @param unit the unit to use. | |||
| * @deprecated setUnit(String) is deprecated and is replaced with | |||
| * setUnit(Tstamp.Unit) to make Ant's | |||
| * Introspection mechanism do the work and also to | |||
| @@ -226,16 +229,16 @@ public class Tstamp extends Task { | |||
| * <li>year</li> | |||
| * </ul> | |||
| * The default unit is day. | |||
| * @param unit | |||
| * @param unit the unit to use. | |||
| */ | |||
| public void setUnit(Unit unit) { | |||
| field = unit.getCalendarField(); | |||
| } | |||
| /** | |||
| * validate parameter and execute the format | |||
| * @param project project to set property in | |||
| * @param date date to use as a starting point | |||
| * validate parameter and execute the format. | |||
| * @param project project to set property in. | |||
| * @param date date to use as a starting point. | |||
| * @param location line in file (for errors) | |||
| */ | |||
| public void execute(Project project, Date date, Location location) { | |||
| @@ -287,7 +290,7 @@ public class Tstamp extends Task { | |||
| private static final String MONTH = "month"; | |||
| private static final String YEAR = "year"; | |||
| private static final String[] units = { | |||
| private static final String[] UNITS = { | |||
| MILLISECOND, | |||
| SECOND, | |||
| MINUTE, | |||
| @@ -300,6 +303,7 @@ public class Tstamp extends Task { | |||
| private Hashtable calendarFields = new Hashtable(); | |||
| /** Constructor for Unit enumerated type. */ | |||
| public Unit() { | |||
| calendarFields.put(MILLISECOND, | |||
| new Integer(Calendar.MILLISECOND)); | |||
| @@ -312,14 +316,22 @@ public class Tstamp extends Task { | |||
| calendarFields.put(YEAR, new Integer(Calendar.YEAR)); | |||
| } | |||
| /** | |||
| * Convert the value to int unit value. | |||
| * @return an int value. | |||
| */ | |||
| public int getCalendarField() { | |||
| String key = getValue().toLowerCase(); | |||
| Integer i = (Integer) calendarFields.get(key); | |||
| return i.intValue(); | |||
| } | |||
| /** | |||
| * Get the valid values. | |||
| * @return the value values. | |||
| */ | |||
| public String[] getValues() { | |||
| return units; | |||
| return UNITS; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2002-2004 The Apache Software Foundation | |||
| * Copyright 2002-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -145,9 +145,11 @@ public class Message extends ProjectComponent { | |||
| public boolean isMimeTypeSpecified() { | |||
| return specified; | |||
| } | |||
| /** | |||
| * Sets the character set of mail message. | |||
| * Will be ignored if mimeType contains ....; Charset=... substring. | |||
| * @param charset the character set name. | |||
| * @since Ant 1.6 | |||
| */ | |||
| public void setCharset(String charset) { | |||
| @@ -86,6 +86,7 @@ public class Javah extends Task { | |||
| /** | |||
| * the fully-qualified name of the class (or classes, separated by commas). | |||
| * @param cls the classname (or classnames). | |||
| */ | |||
| public void setClass(String cls) { | |||
| this.cls = cls; | |||
| @@ -93,6 +94,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Adds class to process. | |||
| * @return a <code>ClassArgument</code> to be configured. | |||
| */ | |||
| public ClassArgument createClass() { | |||
| ClassArgument ga = new ClassArgument(); | |||
| @@ -100,16 +102,29 @@ public class Javah extends Task { | |||
| return ga; | |||
| } | |||
| /** | |||
| * A class corresponding the the nested "class" element. | |||
| * It contains a "name" attribute. | |||
| */ | |||
| public class ClassArgument { | |||
| private String name; | |||
| /** Constructor for ClassArgument. */ | |||
| public ClassArgument() { | |||
| } | |||
| /** | |||
| * Set the name attribute. | |||
| * @param name the name attribute. | |||
| */ | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| /** | |||
| * Get the name attribute. | |||
| * @return the name attribute. | |||
| */ | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| @@ -140,6 +155,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Set the destination directory into which the Java source | |||
| * files should be compiled. | |||
| * @param destDir the destination directory. | |||
| */ | |||
| public void setDestdir(File destDir) { | |||
| this.destDir = destDir; | |||
| @@ -156,6 +172,7 @@ public class Javah extends Task { | |||
| /** | |||
| * the classpath to use. | |||
| * @param src the classpath. | |||
| */ | |||
| public void setClasspath(Path src) { | |||
| if (classpath == null) { | |||
| @@ -167,6 +184,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Path to use for classpath. | |||
| * @return a path to be configured. | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| @@ -177,7 +195,8 @@ public class Javah extends Task { | |||
| /** | |||
| * Adds a reference to a classpath defined elsewhere. | |||
| * @todo this needs to be documented in the HTML docs | |||
| * @param r a reference to a classpath. | |||
| * @todo this needs to be documented in the HTML docs. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| createClasspath().setRefid(r); | |||
| @@ -194,6 +213,7 @@ public class Javah extends Task { | |||
| /** | |||
| * location of bootstrap class files. | |||
| * @param src the bootstrap classpath. | |||
| */ | |||
| public void setBootclasspath(Path src) { | |||
| if (bootclasspath == null) { | |||
| @@ -205,6 +225,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Adds path to bootstrap class files. | |||
| * @return a path to be configured. | |||
| */ | |||
| public Path createBootclasspath() { | |||
| if (bootclasspath == null) { | |||
| @@ -214,8 +235,9 @@ public class Javah extends Task { | |||
| } | |||
| /** | |||
| * Adds a reference to a classpath defined elsewhere. | |||
| * @todo this needs to be documented in the HTML | |||
| * To the bootstrap path, this adds a reference to a classpath defined elsewhere. | |||
| * @param r a reference to a classpath | |||
| * @todo this needs to be documented in the HTML. | |||
| */ | |||
| public void setBootClasspathRef(Reference r) { | |||
| createBootclasspath().setRefid(r); | |||
| @@ -233,6 +255,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Concatenates the resulting header or source files for all | |||
| * the classes listed into this file. | |||
| * @param outputFile the output file. | |||
| */ | |||
| public void setOutputFile(File outputFile) { | |||
| this.outputFile = outputFile; | |||
| @@ -249,6 +272,7 @@ public class Javah extends Task { | |||
| /** | |||
| * If true, output files should always be written (JDK1.2 only). | |||
| * @param force the value to use. | |||
| */ | |||
| public void setForce(boolean force) { | |||
| this.force = force; | |||
| @@ -266,7 +290,9 @@ public class Javah extends Task { | |||
| /** | |||
| * If true, specifies that old JDK1.0-style header files should be | |||
| * generated. | |||
| * (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only) | |||
| * (otherwise output file contain JNI-style native method function | |||
| * prototypes) (JDK1.2 only). | |||
| * @param old if true use old 1.0 style header files. | |||
| */ | |||
| public void setOld(boolean old) { | |||
| this.old = old; | |||
| @@ -283,6 +309,7 @@ public class Javah extends Task { | |||
| /** | |||
| * If true, generate C declarations from the Java object file (used with old). | |||
| * @param stubs if true, generated C declarations. | |||
| */ | |||
| public void setStubs(boolean stubs) { | |||
| this.stubs = stubs; | |||
| @@ -300,6 +327,7 @@ public class Javah extends Task { | |||
| /** | |||
| * If true, causes Javah to print a message concerning | |||
| * the status of the generated files. | |||
| * @param verbose if true, do verbose printing. | |||
| */ | |||
| public void setVerbose(boolean verbose) { | |||
| this.verbose = verbose; | |||
| @@ -316,7 +344,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Choose the implementation for this particular task. | |||
| * @param impl the name of the implemenation | |||
| * @param impl the name of the implemenation. | |||
| * @since Ant 1.6.3 | |||
| */ | |||
| public void setImplementation(String impl) { | |||
| @@ -329,7 +357,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Adds an implementation specific command-line argument. | |||
| * @return a ImplementationSpecificArgument to be configured | |||
| * @return a ImplementationSpecificArgument to be configured. | |||
| * | |||
| * @since Ant 1.6.3 | |||
| */ | |||
| @@ -404,6 +432,7 @@ public class Javah extends Task { | |||
| /** | |||
| * Logs the compilation parameters, adds the files to compile and logs the | |||
| * "niceSourceList" | |||
| * @param cmd the command line to add parameters to. | |||
| */ | |||
| protected void logAndAddFilesToCompile(Commandline cmd) { | |||
| log("Compilation " + cmd.describeArguments(), | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2001-2004 The Apache Software Foundation | |||
| * Copyright 2001-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -101,9 +101,18 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware | |||
| /** factory attributes */ | |||
| private Vector attributes = new Vector(); | |||
| /** | |||
| * Constructor for TraXLiaison. | |||
| * @throws Exception never | |||
| */ | |||
| public TraXLiaison() throws Exception { | |||
| } | |||
| /** | |||
| * Set the stylesheet file. | |||
| * @param stylesheet a <code>File</code> value | |||
| * @throws Exception on error | |||
| */ | |||
| public void setStylesheet(File stylesheet) throws Exception { | |||
| if (this.stylesheet != null) { | |||
| // resetting the stylesheet - reset transformer | |||
| @@ -118,6 +127,12 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware | |||
| this.stylesheet = stylesheet; | |||
| } | |||
| /** | |||
| * Transform an input file. | |||
| * @param infile the file to transform | |||
| * @param outfile the result file | |||
| * @throws Exception on error | |||
| */ | |||
| public void transform(File infile, File outfile) throws Exception { | |||
| if (transformer == null) { | |||
| createTransformer(); | |||
| @@ -316,36 +331,61 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware | |||
| outputProperties.addElement(pair); | |||
| } | |||
| /** Set the class to resolve entities during the transformation | |||
| /** | |||
| * Set the class to resolve entities during the transformation. | |||
| * @param aResolver the resolver class. | |||
| */ | |||
| public void setEntityResolver(EntityResolver aResolver) { | |||
| entityResolver = aResolver; | |||
| } | |||
| /** Set the class to resolve URIs during the transformation | |||
| /** | |||
| * Set the class to resolve URIs during the transformation | |||
| * @param aResolver a <code>EntityResolver</code> value | |||
| */ | |||
| public void setURIResolver(URIResolver aResolver) { | |||
| uriResolver = aResolver; | |||
| } | |||
| /** | |||
| * Add a parameter. | |||
| * @param name the name of the parameter | |||
| * @param value the value of the parameter | |||
| */ | |||
| public void addParam(String name, String value) { | |||
| final String[] pair = new String[]{name, value}; | |||
| params.addElement(pair); | |||
| } | |||
| /** | |||
| * Set a logger. | |||
| * @param l a logger. | |||
| */ | |||
| public void setLogger(XSLTLogger l) { | |||
| logger = l; | |||
| } | |||
| /** | |||
| * Log an error. | |||
| * @param e the exception to log. | |||
| */ | |||
| public void error(TransformerException e) { | |||
| logError(e, "Error"); | |||
| } | |||
| /** | |||
| * Log a fatal error. | |||
| * @param e the exception to log. | |||
| */ | |||
| public void fatalError(TransformerException e) { | |||
| logError(e, "Fatal Error"); | |||
| throw new BuildException("Fatal error during transformation", e); | |||
| } | |||
| /** | |||
| * Log a warning. | |||
| * @param e the exception to log. | |||
| */ | |||
| public void warning(TransformerException e) { | |||
| logError(e, "Warning"); | |||
| } | |||
| @@ -388,6 +428,8 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware | |||
| // kept for backwards compatibility | |||
| /** | |||
| * @param file the filename to use for the systemid | |||
| * @return the systemid | |||
| * @deprecated use org.apache.tools.ant.util.JAXPUtils#getSystemId instead | |||
| */ | |||
| protected String getSystemId(File file) { | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000-2002,2004 The Apache Software Foundation | |||
| * Copyright 2000-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -37,14 +37,29 @@ public class XalanLiaison implements XSLTLiaison { | |||
| protected XSLTProcessor processor; | |||
| protected File stylesheet; | |||
| /** | |||
| * Constructor for XalanLiaison. | |||
| * @throws Exception on error | |||
| */ | |||
| public XalanLiaison() throws Exception { | |||
| processor = XSLTProcessorFactory.getProcessor(); | |||
| } | |||
| /** | |||
| * Set the style sheet to use. | |||
| * @param stylesheet the style sheet file to use | |||
| * @throws Exception on error | |||
| */ | |||
| public void setStylesheet(File stylesheet) throws Exception { | |||
| this.stylesheet = stylesheet; | |||
| } | |||
| /** | |||
| * Carry out the transformation. | |||
| * @param infile the input file | |||
| * @param outfile the output file | |||
| * @throws Exception on error | |||
| */ | |||
| public void transform(File infile, File outfile) throws Exception { | |||
| FileInputStream fis = null; | |||
| FileOutputStream fos = null; | |||
| @@ -89,6 +104,11 @@ public class XalanLiaison implements XSLTLiaison { | |||
| } | |||
| } | |||
| /** | |||
| * Add a parameter. | |||
| * @param name the name of the parameter | |||
| * @param value the value of the parameter | |||
| */ | |||
| public void addParam(String name, String value) { | |||
| processor.setStylesheetParam(name, value); | |||
| } | |||