<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FAnt%2FCustom_Task</id>
		<title>Java/Ant/Custom Task - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FAnt%2FCustom_Task"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Ant/Custom_Task&amp;action=history"/>
		<updated>2026-04-05T21:29:57Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Ant/Custom_Task&amp;diff=7225&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Ant/Custom_Task&amp;diff=7225&amp;oldid=prev"/>
				<updated>2010-06-01T06:37:18Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:37, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Ant/Custom_Task&amp;diff=7224&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Ant/Custom_Task&amp;diff=7224&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Ant Write Our Own Task ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 *  Uses org.apache.tools.ant.Main,&lt;br /&gt;
 *  which is Copyright 2000-2005 The Apache Software Foundation.&lt;br /&gt;
 *&lt;br /&gt;
 *  Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 *  you may not use this file except in compliance with the License.&lt;br /&gt;
 *  You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 *  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 *  distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 *  See the License for the specific language governing permissions and&lt;br /&gt;
 *  limitations under the License.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
package org.mwrm.ant.tasks;&lt;br /&gt;
import org.apache.tools.ant.Task;&lt;br /&gt;
import org.apache.tools.ant.Main;&lt;br /&gt;
/**&lt;br /&gt;
 * &amp;lt;p&amp;gt;The &amp;lt;code&amp;gt;ProjectHelpTask&amp;lt;/code&amp;gt; class displays usage information&lt;br /&gt;
 * for the current project. This is the same information as is displayed&lt;br /&gt;
 * by &amp;lt;code&amp;gt;-projecthelp&amp;lt;/code&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class ProjectHelpTask extends Task {&lt;br /&gt;
    /** The location of the build file to use&lt;br /&gt;
     * when obtaining usage information. */&lt;br /&gt;
    private String buildfile;&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Runs the task.&lt;br /&gt;
     * It calls {@link org.apache.tools.ant.Main#main(String[] args)&lt;br /&gt;
     * org.apache.tools.ant.Main.main()} with the &amp;lt;code&amp;gt;-projecthelp&amp;lt;/code&amp;gt;&lt;br /&gt;
     * parameter. It will also send the current build file&amp;quot;s file name&lt;br /&gt;
     * via the &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt; parameter.&amp;lt;/p&amp;gt;&lt;br /&gt;
     *&lt;br /&gt;
     * &amp;lt;p&amp;gt;The &amp;lt;code&amp;gt;buildfile&amp;lt;/code&amp;gt; attribute is optional.&lt;br /&gt;
     * The default is the task&amp;quot;s build file.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @see org.apache.tools.ant.Main org.apache.tools.ant.Main&lt;br /&gt;
     */&lt;br /&gt;
    public final void execute() {&lt;br /&gt;
        // If the buildfile attribute is null, we&amp;quot;ll use the task&amp;quot;s build file&lt;br /&gt;
        if (buildfile == null) {&lt;br /&gt;
            buildfile = getLocation().getFileName();&lt;br /&gt;
        }&lt;br /&gt;
        // The arguments that we will pass to the Main class.&lt;br /&gt;
        // The buildfile attribute must follow the -f parameter.&lt;br /&gt;
        String[] args = {&amp;quot;-projecthelp&amp;quot;, &amp;quot;-f&amp;quot;, buildfile};&lt;br /&gt;
        // Call the Main Ant class with the arguments.&lt;br /&gt;
        Main.main(args);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Setter method for the &amp;lt;code&amp;gt;buildfile&amp;lt;/code&amp;gt; attribute.&lt;br /&gt;
     * @param file The file name of the build file to use.&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public final void setBuildfile(final String file) {&lt;br /&gt;
        this.buildfile = file;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create your own Ant task ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Code revised from &lt;br /&gt;
&lt;br /&gt;
Cooking with Java XP&lt;br /&gt;
by Eric M. Burke and Brian M. Coyner&lt;br /&gt;
ISBN: 0-596-00387-0&lt;br /&gt;
Pages: 288&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;project name=&amp;quot;Ant Task&amp;quot; default=&amp;quot;compile&amp;quot; basedir=&amp;quot;.&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;property name=&amp;quot;dir.build&amp;quot; value=&amp;quot;build&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;property name=&amp;quot;dir.dist&amp;quot; value=&amp;quot;dist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;property name=&amp;quot;dir.src&amp;quot; value=&amp;quot;src&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;path id=&amp;quot;classpath.project&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;pathelement path=&amp;quot;${dir.build}&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/path&amp;gt;&lt;br /&gt;
  &amp;lt;target name=&amp;quot;compile&amp;quot; description=&amp;quot;Compile all source code.&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;javac srcdir=&amp;quot;${dir.src}&amp;quot; destdir=&amp;quot;${dir.build}&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;classpath refid=&amp;quot;classpath.project&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/javac&amp;gt;&lt;br /&gt;
  &amp;lt;/target&amp;gt;&lt;br /&gt;
  &amp;lt;target name=&amp;quot;demoDialogBox&amp;quot; depends=&amp;quot;compile&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;taskdef name=&amp;quot;dialogbox&amp;quot;&lt;br /&gt;
              classname=&amp;quot;DialogBoxTask&amp;quot;&lt;br /&gt;
              classpath=&amp;quot;${dir.build}&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;dialogbox message=&amp;quot;Are you ready?&amp;quot;&lt;br /&gt;
                 title=&amp;quot;Important Question&amp;quot;&lt;br /&gt;
                 property=&amp;quot;response&amp;quot;&lt;br /&gt;
                 optiontype=&amp;quot;yes_no&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;dialogbox message=&amp;quot;You entered ${response}!&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;dialogbox title=&amp;quot;First response: ${response}&amp;quot;&amp;gt;This is a dialog with a multi-line message.&amp;lt;/dialogbox&amp;gt;&lt;br /&gt;
  &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/project&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
import org.apache.tools.ant.BuildException;&lt;br /&gt;
import org.apache.tools.ant.Project;&lt;br /&gt;
import org.apache.tools.ant.ProjectHelper;&lt;br /&gt;
import org.apache.tools.ant.Task;&lt;br /&gt;
import org.apache.tools.ant.types.EnumeratedAttribute;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
public class DialogBoxTask extends Task {&lt;br /&gt;
    private String message;&lt;br /&gt;
    private String title = &amp;quot;Question&amp;quot;;&lt;br /&gt;
    private int optionType = -1;&lt;br /&gt;
    private String propertyName;&lt;br /&gt;
    public void setTitle(String title) {&lt;br /&gt;
        this.title = title;&lt;br /&gt;
    }&lt;br /&gt;
    public void setProperty(String propertyName) {&lt;br /&gt;
        this.propertyName = propertyName;&lt;br /&gt;
    }&lt;br /&gt;
    public void setOptiontype(OptionType ot) {&lt;br /&gt;
        log(&amp;quot;Calling setOptionType: &amp;quot; + ot.getValue(),&lt;br /&gt;
                Project.MSG_DEBUG);&lt;br /&gt;
        String value = ot.getValue();&lt;br /&gt;
        if (&amp;quot;ok&amp;quot;.equals(value)) {&lt;br /&gt;
            optionType = -1;&lt;br /&gt;
        } else if (&amp;quot;ok_cancel&amp;quot;.equals(value)) {&lt;br /&gt;
            optionType = JOptionPane.OK_CANCEL_OPTION;&lt;br /&gt;
        } else if (&amp;quot;yes_no&amp;quot;.equals(value)) {&lt;br /&gt;
            optionType = JOptionPane.YES_NO_OPTION;&lt;br /&gt;
        } else {&lt;br /&gt;
            // only remaining possibility&lt;br /&gt;
            optionType = JOptionPane.YES_NO_CANCEL_OPTION;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public void setMessage(String msg) {&lt;br /&gt;
        // ant always replaces properties for attributes&lt;br /&gt;
        message = msg;&lt;br /&gt;
    }&lt;br /&gt;
    public void addText(String msg) {&lt;br /&gt;
        if (message == null) {&lt;br /&gt;
            message = &amp;quot;&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        // we must manually replace properties for nested text&lt;br /&gt;
        message += ProjectHelper.replaceProperties(&lt;br /&gt;
                getProject(), msg, getProject().getProperties());&lt;br /&gt;
    }&lt;br /&gt;
    public void execute() throws BuildException {&lt;br /&gt;
        validateAttributes();&lt;br /&gt;
        log(&amp;quot;optionType = &amp;quot; + optionType, Project.MSG_DEBUG);&lt;br /&gt;
        if (optionType == -1) {&lt;br /&gt;
            JOptionPane.showMessageDialog(&lt;br /&gt;
                    null, // parent&lt;br /&gt;
                    message,&lt;br /&gt;
                    title,&lt;br /&gt;
                    JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;
        } else {&lt;br /&gt;
            int response = JOptionPane.showConfirmDialog(&lt;br /&gt;
                    null, // parent&lt;br /&gt;
                    message,&lt;br /&gt;
                    title,&lt;br /&gt;
                    optionType,&lt;br /&gt;
                    JOptionPane.QUESTION_MESSAGE);&lt;br /&gt;
            if (propertyName != null) {&lt;br /&gt;
                String responseText = formatResponseCode(response);&lt;br /&gt;
                log(&amp;quot;Setting &amp;quot; + propertyName + &amp;quot; to &amp;quot; + responseText,&lt;br /&gt;
                        Project.MSG_VERBOSE);&lt;br /&gt;
                getProject().setProperty(propertyName, responseText);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    protected void validateAttributes() {&lt;br /&gt;
        if (message == null) {&lt;br /&gt;
            throw new BuildException(&amp;quot;Message must be specified using the &amp;quot;&lt;br /&gt;
                    + &amp;quot;message attribute or nested text.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        if (optionType == -1 &amp;amp;&amp;amp; propertyName != null) {&lt;br /&gt;
            throw new BuildException(&lt;br /&gt;
                    &amp;quot;Cannot specify property unless optionType is &amp;quot;&lt;br /&gt;
                    + &amp;quot;&amp;quot;ok_cancel&amp;quot;, &amp;quot;yes_no&amp;quot;, or &amp;quot;yes_no_cancel&amp;quot;&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public static class OptionType extends EnumeratedAttribute {&lt;br /&gt;
        public String[] getValues() {&lt;br /&gt;
            return new String[]{&lt;br /&gt;
                &amp;quot;ok&amp;quot;,&lt;br /&gt;
                &amp;quot;ok_cancel&amp;quot;,&lt;br /&gt;
                &amp;quot;yes_no&amp;quot;,&lt;br /&gt;
                &amp;quot;yes_no_cancel&amp;quot;,&lt;br /&gt;
            };&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private String formatResponseCode(int optionPaneResponse) {&lt;br /&gt;
        switch (optionPaneResponse) {&lt;br /&gt;
            // note: JOptionPane.OK_OPTION is the same as YES_OPTION&lt;br /&gt;
            case JOptionPane.YES_OPTION:&lt;br /&gt;
                return &amp;quot;yes&amp;quot;;&lt;br /&gt;
            case JOptionPane.NO_OPTION:&lt;br /&gt;
                return &amp;quot;no&amp;quot;;&lt;br /&gt;
            case JOptionPane.CANCEL_OPTION:&lt;br /&gt;
            case JOptionPane.CLOSED_OPTION:&lt;br /&gt;
                return &amp;quot;cancel&amp;quot;;&lt;br /&gt;
            default:&lt;br /&gt;
                throw new BuildException(&amp;quot;Internal error: Unknown option &amp;quot; +&lt;br /&gt;
                        &amp;quot;pane response: &amp;quot; + optionPaneResponse);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Extend Javadoc Task  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 *  Extends org.apache.tools.ant.taskdefs.Javadoc&lt;br /&gt;
 *  and uses org.apache.tools.ant.taskdefs.UpToDate,&lt;br /&gt;
 *  which are Copyright 2000-2005 The Apache Software Foundation.&lt;br /&gt;
 *&lt;br /&gt;
 *  Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 *  you may not use this file except in compliance with the License.&lt;br /&gt;
 *  You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 *  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 *  distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 *  See the License for the specific language governing permissions and&lt;br /&gt;
 *  limitations under the License.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
package org.mwrm.ant.tasks;&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import java.util.Enumeration;&lt;br /&gt;
import java.util.StringTokenizer;&lt;br /&gt;
import java.util.Vector;&lt;br /&gt;
import org.apache.tools.ant.Project;&lt;br /&gt;
import org.apache.tools.ant.BuildException;&lt;br /&gt;
import org.apache.tools.ant.taskdefs.Javadoc;&lt;br /&gt;
import org.apache.tools.ant.taskdefs.UpToDate;&lt;br /&gt;
import org.apache.tools.ant.types.FileSet;&lt;br /&gt;
/**&lt;br /&gt;
 * &amp;lt;p&amp;gt;The &amp;lt;code&amp;gt;ExtendJavadocTask&amp;lt;/code&amp;gt; class&lt;br /&gt;
 * extends the {@link org.apache.tools.ant.taskdefs.Javadoc Javadoc} task.&lt;br /&gt;
 * It checks whether a set of source files are newer than a set of target files&lt;br /&gt;
 * and if so, it generates Javadocs.&amp;lt;/p&amp;gt;&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class ExtendJavadocTask extends Javadoc {&lt;br /&gt;
    /** The attribute of the task element. */&lt;br /&gt;
    private File target;&lt;br /&gt;
    /** A set of file sets,&lt;br /&gt;
     * each of which is provided by a nested file set. */&lt;br /&gt;
    private Vector targetFileSets  = new Vector();&lt;br /&gt;
    /** The internal uptodate task. */&lt;br /&gt;
    private UpToDate utd;&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Creates a new instance of an internal&lt;br /&gt;
     * &amp;lt;code&amp;gt;&amp;amp;lt;uptodate&amp;amp;gt;&amp;lt;/code&amp;gt; task&lt;br /&gt;
     * and adds it to the current project.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @see UpToDate org.apache.tools.ant.taskdefs.UpToDate&lt;br /&gt;
     */&lt;br /&gt;
    public final void init() {&lt;br /&gt;
        // We need an instance of the &amp;lt;uptodate&amp;gt; task&lt;br /&gt;
        utd = new UpToDate();&lt;br /&gt;
        // We need to add the task to this project&lt;br /&gt;
        utd.setProject(this.getProject());&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Checks if Javadocs should be created&lt;br /&gt;
     * and then calls &amp;lt;code&amp;gt;super.execute()&amp;lt;/code&amp;gt; if so.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * &amp;lt;p&amp;gt;This method does usage checks on the task&amp;quot;s attributes&lt;br /&gt;
     * and its nested elements.&lt;br /&gt;
     * It will throw a &amp;lt;code&amp;gt;BuildException&amp;lt;/code&amp;gt; if there is a violation.&amp;lt;/p&amp;gt;&lt;br /&gt;
     */&lt;br /&gt;
    public final void execute() {&lt;br /&gt;
        // This is the usage information&lt;br /&gt;
        // We can&amp;quot;t have a target attribute&lt;br /&gt;
        // and nested targetfiles elements&lt;br /&gt;
        if (target != null &amp;amp;&amp;amp; targetFileSets.size() &amp;gt; 0) {&lt;br /&gt;
            String msg = &amp;quot;You can&amp;quot;t specify a targetfile attribute &amp;quot;&lt;br /&gt;
                + &amp;quot;and &amp;lt;targetfiles&amp;gt; elements.&amp;quot;;&lt;br /&gt;
            throw new BuildException(msg);&lt;br /&gt;
        }&lt;br /&gt;
        // We have to specify either a target attribute&lt;br /&gt;
        // or at least one nested targetfiles elements&lt;br /&gt;
        if (target == null &amp;amp;&amp;amp; targetFileSets.size() == 0) {&lt;br /&gt;
            String msg = &amp;quot;You must specify either a targetfile attribute &amp;quot;&lt;br /&gt;
                + &amp;quot;or at least one &amp;lt;targetfiles&amp;gt; element.&amp;quot;;&lt;br /&gt;
            throw new BuildException(msg);&lt;br /&gt;
        }&lt;br /&gt;
        // If this is false, the files aren&amp;quot;t up to date&lt;br /&gt;
        // and we have to run the javadocs&lt;br /&gt;
        boolean eval = false;&lt;br /&gt;
        // If we&amp;quot;ve got to this point, we know the usage must be correct.&lt;br /&gt;
        // Let&amp;quot;s check whether a single target attribute has been used.&lt;br /&gt;
        if (target != null) {&lt;br /&gt;
            // Get the results of the check&lt;br /&gt;
            eval = getResult(target);&lt;br /&gt;
        } else {&lt;br /&gt;
            // If a target attribute wasn&amp;quot;t specified,&lt;br /&gt;
            // at least one nested targetfiles element was.&lt;br /&gt;
            // We first get all the file sets represented by the nested elements&lt;br /&gt;
            Enumeration e = targetFileSets.elements();&lt;br /&gt;
            // And then iterate over them&lt;br /&gt;
            while (e.hasMoreElements()) {&lt;br /&gt;
                // The next element is a file set, so we get its files&lt;br /&gt;
                // in a semi-colon-separated list&lt;br /&gt;
                String files = e.nextElement().toString();&lt;br /&gt;
                // Next, we split the list into its file names&lt;br /&gt;
                StringTokenizer st = new StringTokenizer(files, &amp;quot;;&amp;quot;);&lt;br /&gt;
                // And iterate over them to test each one&lt;br /&gt;
                while (st.hasMoreTokens()) {&lt;br /&gt;
                    // We create a file&lt;br /&gt;
                    //from the current file name in the iteration&lt;br /&gt;
                    File tempTarget = new File(st.nextToken());&lt;br /&gt;
                    // Get the results of the check&lt;br /&gt;
                    eval = getResult(tempTarget);&lt;br /&gt;
                    // One false result is enough to fail the whole file set&lt;br /&gt;
                    if (!eval) {&lt;br /&gt;
                        break;&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
                // One false result is enough to fail the whole file set&lt;br /&gt;
                if (!eval) {&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        // If the test failed, we want to generate Javadocs&lt;br /&gt;
        if (!eval) {&lt;br /&gt;
            super.execute();&lt;br /&gt;
        } else {&lt;br /&gt;
            log(&amp;quot;Skipping Javadoc creation. The files are up to date.&amp;quot;,&lt;br /&gt;
                Project.MSG_INFO);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    /** &amp;lt;p&amp;gt;Checks whether the files are up to date.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param file The file to evaluate&lt;br /&gt;
     * @return boolean The result&lt;br /&gt;
     */&lt;br /&gt;
    private boolean getResult(final File file) {&lt;br /&gt;
        // Set the target property in the &amp;lt;uptodate&amp;gt; task&lt;br /&gt;
        utd.setTargetFile(file);&lt;br /&gt;
        // Evaluate the files&lt;br /&gt;
        return utd.eval();&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;The setter method for the &amp;lt;code&amp;gt;target&amp;lt;/code&amp;gt; attribute.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param targetFile A file to check against&lt;br /&gt;
     */&lt;br /&gt;
    public final void setTarget(final File targetFile) {&lt;br /&gt;
        this.target = targetFile;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;The setter method for the file set&lt;br /&gt;
     * contained in the nested &amp;lt;code&amp;gt;&amp;amp;lt;srcfiles&amp;amp;gt;&amp;lt;/code&amp;gt; element.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param fileset A file set of source files&lt;br /&gt;
     */&lt;br /&gt;
    public final void addSrcfiles(final FileSet fileset) {&lt;br /&gt;
        utd.addSrcfiles(fileset);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;The setter method for the file sets&lt;br /&gt;
     * contained in nested &amp;lt;code&amp;gt;&amp;amp;lt;targetfiles&amp;amp;gt;&amp;lt;/code&amp;gt; elements.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param fileset A file set of target files&lt;br /&gt;
     */&lt;br /&gt;
    public final void addTargetfiles(final FileSet fileset) {&lt;br /&gt;
        targetFileSets.add(fileset);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to use a Class argument in a custom class attribute ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 *&lt;br /&gt;
 *  Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 *  you may not use this file except in compliance with the License.&lt;br /&gt;
 *  You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 *  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 *  distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 *  See the License for the specific language governing permissions and&lt;br /&gt;
 *  limitations under the License.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
package org.mwrm.ant.tasks;&lt;br /&gt;
import org.apache.tools.ant.Project;&lt;br /&gt;
import org.apache.tools.ant.Task;&lt;br /&gt;
import org.apache.tools.ant.BuildException;&lt;br /&gt;
/**&lt;br /&gt;
 * &amp;lt;p&amp;gt;The &amp;lt;code&amp;gt;ClassSetTask&amp;lt;/code&amp;gt; class&lt;br /&gt;
 * demonstrates how to use a &amp;lt;code&amp;gt;Class&amp;lt;/code&amp;gt; argument&lt;br /&gt;
 * in a custom class attribute.&amp;lt;/p&amp;gt;&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class ClassSetTask extends Task {&lt;br /&gt;
    /** The qualified class name. */&lt;br /&gt;
    private Class qualifiedName;&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Runs the task and displays the qualified name of the class&lt;br /&gt;
     * that is set as the &amp;lt;code&amp;gt;setQualifiedName&amp;lt;/code&amp;gt; attribute.&amp;lt;/p&amp;gt;&lt;br /&gt;
     *&lt;br /&gt;
     */&lt;br /&gt;
    public final void execute() {&lt;br /&gt;
        log(&amp;quot;qualifiedName: &amp;quot; + qualifiedName, Project.MSG_INFO);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Sets the fully qualified name of the class.&amp;lt;/p&amp;gt;&lt;br /&gt;
     ** @param qName The fully qualified name of a class&lt;br /&gt;
     */&lt;br /&gt;
    public final void setQualifiedName(final Class qName) {&lt;br /&gt;
        if (qName.getName().equals(&amp;quot;java.lang.Integer&amp;quot;)&lt;br /&gt;
            ||&lt;br /&gt;
            qName.getName().equals(&amp;quot;java.lang.String&amp;quot;)) {&lt;br /&gt;
            log(qName.getName() + &amp;quot; found.&amp;quot;, Project.MSG_INFO);&lt;br /&gt;
        } else {&lt;br /&gt;
            String msg = &amp;quot;You can only specify java.lang.Integer &amp;quot;&lt;br /&gt;
                + &amp;quot;or java.lang.String in qualifiedName.&amp;quot;;&lt;br /&gt;
            throw new BuildException(msg);&lt;br /&gt;
        }&lt;br /&gt;
        this.qualifiedName = qName;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Life Cycle Task ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 *&lt;br /&gt;
 *  Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 *  you may not use this file except in compliance with the License.&lt;br /&gt;
 *  You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 *  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 *  distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 *  See the License for the specific language governing permissions and&lt;br /&gt;
 *  limitations under the License.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
package org.mwrm.ant.tasks;&lt;br /&gt;
import java.util.Hashtable;&lt;br /&gt;
import java.util.Enumeration;&lt;br /&gt;
import org.apache.tools.ant.Project;&lt;br /&gt;
import org.apache.tools.ant.Task;&lt;br /&gt;
import org.apache.tools.ant.BuildException;&lt;br /&gt;
/**&lt;br /&gt;
 * &amp;lt;p&amp;gt;At each stage in a task&amp;quot;s life cycle, this class displays information&lt;br /&gt;
 * to show the internal state of the task and its position with in the project.&lt;br /&gt;
 * It takes a &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; attribute.&amp;lt;/p&amp;gt;&lt;br /&gt;
 */&lt;br /&gt;
public class LifeCycleTask extends Task {&lt;br /&gt;
    /** The &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; attribute of this task. */&lt;br /&gt;
    private String name;&lt;br /&gt;
    /** The body text of this task. */&lt;br /&gt;
    private String text;&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;The constructor displays the state of the task&lt;br /&gt;
     * as it is instantiated.&amp;lt;/p&amp;gt;&lt;br /&gt;
     */&lt;br /&gt;
    public LifeCycleTask() {&lt;br /&gt;
        System.out.println(&amp;quot;---------------&amp;quot;);&lt;br /&gt;
        System.out.println(&amp;quot;Constructor called&amp;quot;);&lt;br /&gt;
        System.out.println(&amp;quot;Value of name attribute: &amp;quot; + name);&lt;br /&gt;
        System.out.println(&amp;quot;Value of the body text: &amp;quot; + text);&lt;br /&gt;
        System.out.println(&amp;quot;Project: &amp;quot; + getProject());&lt;br /&gt;
        System.out.println(&amp;quot;Location: &amp;quot; + getLocation());&lt;br /&gt;
        System.out.println(&amp;quot;Target: &amp;quot; + getOwningTarget());&lt;br /&gt;
        System.out.println(&amp;quot;---------------&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Displays the state of the task at initialization.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @see #logAll(String method)&lt;br /&gt;
     */&lt;br /&gt;
    public final void init() {&lt;br /&gt;
        logAll(&amp;quot;init()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Displays the state of the task when Ant runs it.&lt;br /&gt;
     * This method also runs some usage checks&lt;br /&gt;
     * to ensure the task is being used properly.&amp;lt;/p&amp;gt;&lt;br /&gt;
     */&lt;br /&gt;
    public final void execute() {&lt;br /&gt;
        if (name == null) {&lt;br /&gt;
            throw new BuildException(&amp;quot;You must specify a name attribute in &amp;quot;&lt;br /&gt;
                                     + getTaskName() + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        logAll(&amp;quot;execute()&amp;quot;);&lt;br /&gt;
        // Write the name to output&lt;br /&gt;
        log(name, Project.MSG_INFO);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Sets the name to display&lt;br /&gt;
     * and shows the state of the task afterwards.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param aName The name to display&lt;br /&gt;
     */&lt;br /&gt;
    public final void setName(final String aName) {&lt;br /&gt;
        // The value of the name attribute&lt;br /&gt;
        this.name = aName;&lt;br /&gt;
        logAll(&amp;quot;setName()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;Sets the body text of the task&lt;br /&gt;
     * and shows the state of the task afterwards.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param bodyText The body text&lt;br /&gt;
     */&lt;br /&gt;
    public final void addText(final String bodyText) {&lt;br /&gt;
        // If the body text is just whitespace, it might as well be null&lt;br /&gt;
        if (bodyText.trim().equals(&amp;quot;&amp;quot;)) {&lt;br /&gt;
            this.text = null;&lt;br /&gt;
        } else {&lt;br /&gt;
            this.text = bodyText.trim();&lt;br /&gt;
        }&lt;br /&gt;
        logAll(&amp;quot;addText()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    /** &amp;lt;p&amp;gt;Checks for task references.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @return String&lt;br /&gt;
     * A string that tells us details of the reference check&lt;br /&gt;
     */&lt;br /&gt;
    private String referenceCheck() {&lt;br /&gt;
        // The default setting&lt;br /&gt;
        String setString = &amp;quot;Reference not found.&amp;quot;;&lt;br /&gt;
        // We need the references that have been set in this project&lt;br /&gt;
        Hashtable refs = getProject().getReferences();&lt;br /&gt;
        Enumeration e = refs.elements();&lt;br /&gt;
        // Let&amp;quot;s iterate over them&lt;br /&gt;
        while (e.hasMoreElements()) {&lt;br /&gt;
            // We want to work with each object, so we&amp;quot;ll instantiate an object&lt;br /&gt;
            Object obj = e.nextElement();&lt;br /&gt;
            // Check to see whether this object is a task&lt;br /&gt;
            // If it is, we&amp;quot;ll build a string that contains its name and type&lt;br /&gt;
            if (obj.getClass().getName().&lt;br /&gt;
                equals(&amp;quot;org.apache.tools.ant.UnknownElement&amp;quot;)&lt;br /&gt;
                ||&lt;br /&gt;
                obj.getClass().getName().&lt;br /&gt;
                equals(this.getClass().getName())) {&lt;br /&gt;
                Task aTask = (Task) obj;&lt;br /&gt;
                setString =&lt;br /&gt;
                    &amp;quot;Reference to &amp;quot; + aTask.getTaskName() + &amp;quot; found, of type &amp;quot;&lt;br /&gt;
                    + aTask.getClass().getName() + &amp;quot;. &amp;quot;;&lt;br /&gt;
                setString = setString + &amp;quot;Its id is &amp;quot;&lt;br /&gt;
                    + aTask.getRuntimeConfigurableWrapper().&lt;br /&gt;
            getAttributeMap().get(&amp;quot;id&amp;quot;) + &amp;quot;.&amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return setString;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;lt;p&amp;gt;A central logging method that all the life-cycle methods call&lt;br /&gt;
     * to display the state of the task.&lt;br /&gt;
     * It displays the value of the &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; attribute&lt;br /&gt;
     * and other information about the task,&lt;br /&gt;
     * including the name of its project and its location in the build file.&amp;lt;/p&amp;gt;&lt;br /&gt;
     * @param method The name of the method that issued the logging call&lt;br /&gt;
     */&lt;br /&gt;
    public final void logAll(final String method) {&lt;br /&gt;
        log(&amp;quot;---------------&amp;quot;, Project.MSG_VERBOSE);&lt;br /&gt;
        log(method + &amp;quot; called&amp;quot;, Project.MSG_VERBOSE);&lt;br /&gt;
        log(&amp;quot;Value of name attribute: &amp;quot; + name, Project.MSG_VERBOSE);&lt;br /&gt;
        log(&amp;quot;Value of the body text: &amp;quot; + text, Project.MSG_VERBOSE);&lt;br /&gt;
        log(&amp;quot;Project: &amp;quot; + getProject().getName(), Project.MSG_VERBOSE);&lt;br /&gt;
        // Here we build some information on the location&lt;br /&gt;
        // within the build file&lt;br /&gt;
        String locationString = getLocation().getFileName();&lt;br /&gt;
        locationString = locationString + &amp;quot; at line &amp;quot;&lt;br /&gt;
            + getLocation().getLineNumber();&lt;br /&gt;
        // Location.getColumnNumber() is for Ant 1.7+&lt;br /&gt;
        // Comment it out if you are using Ant 1.6.x&lt;br /&gt;
        //locationString = locationString + &amp;quot; and column &amp;quot;&lt;br /&gt;
        // + getLocation().getColumnNumber();&lt;br /&gt;
        log(&amp;quot;Location: &amp;quot; + locationString, Project.MSG_VERBOSE);&lt;br /&gt;
        // We could use the Location.toString() method&lt;br /&gt;
        //log(&amp;quot;Location: &amp;quot; + getLocation(), Project.MSG_VERBOSE);&lt;br /&gt;
        log(&amp;quot;Target: &amp;quot; + getOwningTarget(), Project.MSG_VERBOSE);&lt;br /&gt;
        // referenceCheck() returns a string with information&lt;br /&gt;
        // on any references to custom tasks&lt;br /&gt;
        log(referenceCheck(), Project.MSG_VERBOSE);&lt;br /&gt;
        // If the configuration wrapper is null, we use its&lt;br /&gt;
        // run-time equivalent&lt;br /&gt;
        if (getWrapper() == null) {&lt;br /&gt;
            log(&amp;quot;Reference id: &amp;quot;&lt;br /&gt;
                + getRuntimeConfigurableWrapper().getAttributeMap().get(&amp;quot;id&amp;quot;),&lt;br /&gt;
                Project.MSG_VERBOSE);&lt;br /&gt;
        } else {&lt;br /&gt;
            // This time we use the protected getWrapper() method&lt;br /&gt;
            log(&amp;quot;Reference id: &amp;quot; + getWrapper().getAttributeMap().get(&amp;quot;id&amp;quot;),&lt;br /&gt;
                Project.MSG_VERBOSE);&lt;br /&gt;
        }&lt;br /&gt;
        log(&amp;quot;---------------&amp;quot;, Project.MSG_VERBOSE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The third-party tasks ==&lt;/div&gt;</summary>
			</entry>

	</feed>