KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > macromedia > jrun > ejb > JRunSubTask


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

5 package xdoclet.modules.macromedia.jrun.ejb;
6
7 import xdoclet.XDocletException;
8 import xdoclet.XDocletMessages;
9 import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
10 import xdoclet.util.Translator;
11
12 /**
13  * @author Aslak Hellesøy
14  * @created February 2, 2002
15  * @ant.element display-name="JRun" name="jrun" parent="xdoclet.modules.ejb.EjbDocletTask"
16  * @xdoclet.merge-file file="ejb-container.xml" relates-to="jrun-ejb-jar.xml" description="An XML unparsed entity
17  * containing the contents of the ejb-container element, i.e. (entity-default-store-type?,
18  * session-default-store-type?, file-store-directory?, cmp20-store-manager?)"
19  */

20 public class JRunSubTask extends AbstractEjbDeploymentDescriptorSubTask
21 {
22     private final static String JavaDoc JRUN_DD_FILE_NAME = "jrun-ejb-jar.xml";
23
24     private final static String JavaDoc JRUN_DD_PUBLICID = "-//Macromedia, Inc.//DTD jrun-ejb-jar 4.0//EN";
25
26     private final static String JavaDoc JRUN_DD_SYSTEMID = "http://jrun.macromedia.com/dtds/jrun-ejb-jar.dtd";
27
28     private final static String JavaDoc JRUN_DTD_FILE_NAME = "resources/jrun-ejb-jar.dtd";
29
30     private static String JavaDoc DEFAULT_TEMPLATE_FILE = "resources/jrun-ejb-jar-xml.xdt";
31
32     private String JavaDoc _version = "4.0";
33
34     private String JavaDoc _dataSource = "DefaultDataSource";
35
36     private boolean _createTables = false;
37
38     /**
39      * Gets the Source attribute of the JRunSubTask object
40      *
41      * @return The Source value
42      */

43     public String JavaDoc getSource()
44     {
45         return _dataSource;
46     }
47
48
49     /**
50      * Gets the Version attribute of the JRunSubTask object
51      *
52      * @return The Version value
53      */

54     public String JavaDoc getVersion()
55     {
56         return _version;
57     }
58
59
60     /**
61      * Gets the Createtables attribute of the JRunSubTask object
62      *
63      * @return The Createtables value
64      */

65     public String JavaDoc getCreatetables()
66     {
67         return _createTables ? "True" : "False";
68     }
69
70
71     /**
72      * Sets the Source attribute of the JRunSubTask object
73      *
74      * @param new_data_source The new Source value
75      */

76     public void setSource(String JavaDoc new_data_source)
77     {
78         _dataSource = new_data_source;
79     }
80
81
82     /**
83      * Sets the Version attribute of the JRunSubTask object
84      *
85      * @param version The new Version value
86      */

87     public void setVersion(String JavaDoc version)
88     {
89         _version = version;
90     }
91
92
93     /**
94      * Sets the Createtables attribute of the JRunSubTask object
95      *
96      * @param flag The new Createtables value
97      */

98     public void setCreatetables(boolean flag)
99     {
100         _createTables = flag;
101     }
102
103
104     /**
105      * Called to validate configuration parameters.
106      *
107      * @exception XDocletException Description of Exception
108      */

109     public void validateOptions() throws XDocletException
110     {
111         // JRun does not require a template url or a destination file
112
//
113
// super.validateOptions();
114
}
115
116
117     /**
118      * Describe what the method does
119      *
120      * @exception XDocletException Describe the exception
121      */

122     public void execute() throws XDocletException
123     {
124         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
125         setDestinationFile(JRUN_DD_FILE_NAME);
126         setPublicId(JRUN_DD_PUBLICID);
127         setSystemId(JRUN_DD_SYSTEMID);
128         setDtdURL(getClass().getResource(JRUN_DTD_FILE_NAME));
129
130         startProcess();
131     }
132
133
134     /**
135      * Describe what the method does
136      *
137      * @exception XDocletException Describe the exception
138      */

139     protected void engineStarted() throws XDocletException
140     {
141         if (getDestinationFile().equals(JRUN_DD_FILE_NAME)) {
142             System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String JavaDoc[]{JRUN_DD_FILE_NAME}));
143         }
144     }
145 }
146
Popular Tags