KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > finalist > jag > util > TemplateEngine


1 /* Copyright (C) 2003 Finalist IT Group
2  *
3  * This file is part of JAG - the Java J2EE Application Generator
4  *
5  * JAG is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * JAG is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with JAG; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */

17
18 package com.finalist.jag.util;
19
20 import java.util.Collection JavaDoc;
21
22 /**
23  * A template engine is a component that works from a template file, taking dynamic input from the
24  * JagGenerator, to produce a set of output files.
25  * <p>
26  * <b>NOTE:</b> Implementations of this interface must have a no-args constructor.
27  *
28  * @author Michael O'Connor
29  */

30 public interface TemplateEngine {
31
32 //this interface was introduced as a result of refactoring, so please excuse the poor API! ;)
33

34    /**
35     * This method instructs the template engine to process a collection of template files, and
36     * as a result to create / update / delete files from the output directory.
37     *
38     * @param documents a Collection of File objects, of all the templates that you want to be processed.
39     * @param outputDir the name of the directory where the destination files are.
40     * @return the number of new files created by the process.
41     * @throws InterruptedException The implementation should listen periodically for its Thread being
42     * interrupted and thrown an InterruptedException accordingly. This is the mechanism whereby the user
43     * can halt the process.
44     */

45    int process(Collection JavaDoc documents, String JavaDoc outputDir) throws InterruptedException JavaDoc;
46
47    /**
48     * Allow specifying overwrite mode.
49     * @param overwrite If set to True, the template engine will overwrite the existing files.
50     */

51    void setOverwrite(Boolean JavaDoc overwrite);
52 }
53
Popular Tags