1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  package net.sf.statcvs.ant;
24  
25  import java.io.IOException;
26  
27  import net.sf.statcvs.Main;
28  import net.sf.statcvs.input.LogSyntaxException;
29  import net.sf.statcvs.output.ConfigurationException;
30  import net.sf.statcvs.output.ConfigurationOptions;
31  
32  import org.apache.tools.ant.BuildException;
33  import org.apache.tools.ant.Task;
34  
35  
36  
37  
38  
39  
40  
41  public class StatCvsTask extends Task {
42      private String title;
43      private String logFile;
44      private String pDir;
45      private String outDir;
46      private String cssFile;
47      private String notesFile;
48      private String viewcvs;
49      private String viewvc;
50      private String cvsweb;
51      private String chora;
52      private String jcvsweb;
53      private String bugzilla;
54      private String mantis;
55      private String include = null;
56      private String exclude = null;
57      private String tags;
58      private String format;
59      private String nonDeveloperLogin;
60  
61      
62  
63  
64      public StatCvsTask() {
65          super();
66      }
67  
68      
69  
70  
71  
72      public void execute() throws BuildException {
73          try {
74              this.initProperties();
75              Main.generateDefaultHTMLSuite();
76          } catch (final ConfigurationException e) {
77              throw new BuildException(e.getMessage());
78          } catch (final IOException e) {
79              throw new BuildException(e.getMessage());
80          } catch (final LogSyntaxException e) {
81              throw new BuildException(e.getMessage());
82          }
83      }
84  
85      
86  
87  
88  
89      protected void initProperties() throws ConfigurationException {
90  
91          
92          ConfigurationOptions.setLogFileName(this.logFile);
93          ConfigurationOptions.setCheckedOutDirectory(this.pDir);
94  
95          
96          if (this.title != null) {
97              ConfigurationOptions.setProjectName(this.title);
98          }
99          if (this.outDir != null) {
100             ConfigurationOptions.setOutputDir(this.outDir);
101         }
102         if (cssFile != null) {
103             ConfigurationOptions.setCssFile(this.cssFile);
104         }
105         if (notesFile != null) {
106             ConfigurationOptions.setNotesFile(this.notesFile);
107         }
108         if (viewcvs != null) {
109             ConfigurationOptions.setViewCvsURL(this.viewcvs);
110         }
111         if (viewvc != null) {
112             ConfigurationOptions.setViewVcURL(this.viewvc);
113         }
114         if (cvsweb != null) {
115             ConfigurationOptions.setCvswebURL(this.cvsweb);
116         }
117         if (chora != null) {
118             ConfigurationOptions.setChoraURL(this.chora);
119         }
120         if (jcvsweb != null) {
121             ConfigurationOptions.setJCVSWebURL(this.jcvsweb);
122         }
123         if (bugzilla != null) {
124             ConfigurationOptions.setBugzillaUrl(this.bugzilla);
125         }
126         if (mantis != null) {
127             ConfigurationOptions.setMantisUrl(this.mantis);
128         }
129         if (include != null) {
130             ConfigurationOptions.setIncludePattern(this.include);
131         }
132         if (exclude != null) {
133             ConfigurationOptions.setExcludePattern(this.exclude);
134         }
135         if (tags != null) {
136             ConfigurationOptions.setSymbolicNamesPattern(this.tags);
137         }
138         if (format != null) {
139             ConfigurationOptions.setOutputFormat(this.format);
140         }
141         if (nonDeveloperLogin != null) {
142             ConfigurationOptions.addNonDeveloperLogin(this.nonDeveloperLogin);
143         }
144     }
145 
146     
147 
148 
149     public void setLog(final String logFile) {
150         this.logFile = logFile;
151     }
152 
153     
154 
155 
156     public void setPath(final String modDir) {
157         this.pDir = modDir;
158     }
159 
160     
161 
162 
163     public void setOutputDir(final String outDir) {
164         this.outDir = outDir;
165     }
166 
167     
168 
169 
170 
171 
172     public void setInclude(final String include) {
173         this.include = include;
174     }
175 
176     
177 
178 
179 
180 
181     public void setExclude(final String exclude) {
182         this.exclude = exclude;
183     }
184 
185     
186 
187 
188 
189 
190     public void setTags(final String tags) {
191         this.tags = tags;
192     }
193 
194     
195 
196 
197     public void setTitle(final String title) {
198         this.title = title;
199     }
200 
201     
202 
203 
204     public void setCss(final String cssFile) {
205         this.cssFile = cssFile;
206     }
207 
208     
209 
210 
211 
212     public void setNotes(final String notesFile) {
213         this.notesFile = notesFile;
214     }
215 
216     
217 
218 
219     public void setViewCVS(final String viewcvs) {
220         this.viewcvs = viewcvs;
221     }
222 
223     
224 
225 
226     public void setViewVC(final String viewvc) {
227         this.viewvc = viewvc;
228     }
229 
230     
231 
232 
233     public void setCvsweb(final String cvsweb) {
234         this.cvsweb = cvsweb;
235     }
236 
237     
238 
239 
240     public void setChora(final String chora) {
241         this.chora = chora;
242     }
243 
244     
245 
246 
247     public void setJCVSWeb(final String jcvsweb) {
248         this.jcvsweb = jcvsweb;
249     }
250 
251     
252 
253 
254     public void setBugzilla(final String bugzilla) {
255         this.bugzilla = bugzilla;
256     }
257 
258     
259 
260 
261     public void setMantis(final String mantis) {
262         this.mantis = mantis;
263     }
264 
265     
266 
267 
268     public void setXDoc(final boolean generateXDoc) {
269         this.format = generateXDoc ? "xdoc" : "html";
270     }
271 
272     
273 
274 
275     public void setFormat(final String format) {
276         this.format = format;
277     }
278 
279     
280 
281 
282 
283 
284 
285     public void setNoDeveloper(final String nonDeveloperLogin) {
286         this.nonDeveloperLogin = nonDeveloperLogin;
287     }
288 }