01 
02 /*
03  *  JavaDoq 1.0 - DOCUment JAVA In Source
04  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.javadoq.com>
05  *  
06  *  This program is free software: you can redistribute it and/or modify
07  *  it under the terms of the GNU Affero General Public License as published by
08  *  the Free Software Foundation, either version 3 of the License, or
09  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Affero General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU Affero General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 package com.javadoq;
21 
22 import org.apache.tools.ant.Task;
23 import org.apache.tools.ant.BuildException;
24 
25 import java.io.File;
26 
27 /**
28  * <p>A task for an Ant builder to run JavaDoq.</p>
29  * 
30  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.javadoq.com" target="_blank">http://www.javadoq.com</a>
31  */
32 
33 public class JavaDoqTask extends Task {
34 
35     private JavaDoq jdoq = new JavaDoq();
36 
37     /**
38      * <p>Executes the task.</p>
39      * @since 1.0
40      */
41     @Override
42     public void execute() throws BuildException {
43         try {
44             jdoq.build();
45         }
46         catch (Exception e) {
47             throw new BuildException(e);
48         }
49     }
50 
51     /**
52      * <p>Sets source code directory for JavaDoq.</p>
53      * @param src The directory file of the source code.
54      * @since 1.0
55      */
56     public void setSource(File src) {
57         jdoq.src = src.getAbsolutePath();
58     }
59 
60     /**
61      * <p>Sets target document directory for JavaDoq.</p>
62      * @param dst The directory file for the target documents.
63      * @since 1.0
64      */
65     public void setDestination(File dst) {
66         jdoq.dst = dst.getAbsolutePath();
67     }
68 
69     /**
70      * <p>Sets title for JavaDoq.</p>
71      * @param title The title for the target documents.
72      * @since 1.0
73      */
74     public void setTitle(String title) {
75         jdoq.title = title;
76     }
77 }