KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > ojb > OjbSubTask


1 package xdoclet.modules.ojb;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.commons.logging.Log;
19 import xdoclet.XDocletException;
20 import xdoclet.XmlSubTask;
21 import xdoclet.util.LogUtil;
22
23 /**
24  * Generates the XML metadata for OJB-persistent classes and the descriptions of the associated database tables.
25  *
26  * @author <a HREF="mailto:tomdz@users.sourceforge.net">Thomas Dudziak (tomdz@users.sourceforge.net)</a>
27  * @created March 22, 2003
28  * @ant.element display-name="OJB Repository MetaData" name="ojbrepository" parent="xdoclet.modules.ojb.OjbDocletTask"
29  */

30 public class OjbSubTask extends XmlSubTask
31 {
32     private static String JavaDoc OJB_TEMPLATE_FILE = "resources/ojb_xml.xdt";
33     private static String JavaDoc OJB_REPOSITORY_FILE_NAME = "repository_user.xml";
34
35     /**
36      * Creates a new object.
37      */

38     public OjbSubTask()
39     {
40         setTemplateURL(getClass().getResource(OJB_TEMPLATE_FILE));
41         setDestinationFile(OJB_REPOSITORY_FILE_NAME);
42         setSubTaskName("ojbrepository");
43     }
44
45     /**
46      * Whether to generate verbose output
47      */

48     private boolean _verbose;
49
50     /**
51      * Returns whether we generate verbose output.
52      *
53      * @return <code>true</code> if we generate verbose output
54      */

55     public boolean getVerbose()
56     {
57         return _verbose;
58     }
59
60     /**
61      * Specifies whether we generate verbose output.
62      *
63      * @param beVerbose Whether we generate verbose output
64      */

65     public void setVerbose(boolean beVerbose)
66     {
67         _verbose = beVerbose;
68     }
69
70     /**
71      * Called to validate configuration parameters.
72      *
73      * @exception XDocletException Is not thrown
74      */

75     public void validateOptions() throws XDocletException
76     {
77     }
78
79     /**
80      * Executes the task.
81      *
82      * @exception XDocletException If an error occurs.
83      */

84     public void execute() throws XDocletException
85     {
86         startProcess();
87     }
88
89     public void startProcess() throws XDocletException
90     {
91         Log log = LogUtil.getLog(OjbSubTask.class, "startProcess");
92
93         if (log.isDebugEnabled()) {
94             log.debug("destDir.toString()=" + getDestDir());
95             log.debug("getTemplateURL()=" + getTemplateURL());
96             log.debug("getDestinationfile()=" + getDestinationFile());
97             log.debug("getOfType()=" + getOfType());
98             log.debug("getExtent()=" + getExtent());
99             log.debug("getHavingClassTag()=" + getHavingClassTag());
100         }
101
102         startProcessForAll();
103     }
104
105     /**
106      * Describe what the method does
107      *
108      * @exception XDocletException
109      */

110     protected void engineStarted() throws XDocletException
111     {
112         System.out.println("Generating ojb repository descriptor ("+getDestinationFile()+")");
113     }
114 }
115
Popular Tags