KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > webwork > WebWorkActionsXmlSubTask


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.modules.webwork;
6
7 import xdoclet.XmlSubTask;
8 import xdoclet.XDocletException;
9 import xdoclet.util.Translator;
10
11 /**
12  * Generates the actions.xml file.
13  *
14  * @author Craig Walls, Frank Febbraro (frank@phase2technology.com)
15  * @created April 7, 2003
16  * @ant.element name="webworkactionsxml"
17  * display-name="Generates WebWork actions.xml"
18  * parent="xdoclet.modules.web.WebDocletTask"
19  * @version $Revision: 1.1 $
20  */

21 public class WebWorkActionsXmlSubTask extends XmlSubTask
22 {
23     private static final String JavaDoc DD_FILE_NAME = "resources/actions.dtd";
24
25     private static final String JavaDoc DEFAULT_TEMPLATE_FILE = "resources/webwork_actions_xml.xdt";
26
27     private static final String JavaDoc GENERATED_FILE_NAME = "actions.xml";
28
29     /**
30      * This sets up the defaults, they can be overriden from within the specific tag.
31      */

32     public WebWorkActionsXmlSubTask()
33     {
34         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
35         setDestinationFile(GENERATED_FILE_NAME);
36         addOfType("webwork.action.Action");
37     }
38
39     /**
40      * Set up the DTD incase the generated XMl will be validated.
41      *
42      * @exception XDocletException
43      */

44     public void execute() throws XDocletException
45     {
46         // For validation purposes
47
setDtdURL(getClass().getResource(DD_FILE_NAME));
48
49         startProcess();
50     }
51
52     /**
53      * Prints out a descriptive message while processing.
54      *
55      * @exception XDocletException
56      */

57     protected void engineStarted() throws XDocletException
58     {
59         System.out.println(Translator.getString(XDocletModulesWebWorkMessages.class, XDocletModulesWebWorkMessages.GENERATING_ACTIONS_XML, new String JavaDoc[]{getDestinationFile()}));
60     }
61 }
62
Popular Tags