001: package xdoclet.modules.ojb;
002:
003: /* Copyright 2003-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: import org.apache.commons.logging.Log;
019: import xdoclet.XDocletException;
020: import xdoclet.XmlSubTask;
021: import xdoclet.util.LogUtil;
022:
023: /**
024: * Generates the XML metadata for OJB-persistent classes and the descriptions of the associated database tables.
025: *
026: * @author <a href="mailto:tomdz@users.sourceforge.net">Thomas Dudziak (tomdz@users.sourceforge.net)</a>
027: * @created March 22, 2003
028: * @ant.element display-name="OJB Repository MetaData" name="ojbrepository" parent="xdoclet.modules.ojb.OjbDocletTask"
029: */
030: public class OjbSubTask extends XmlSubTask {
031: private static String OJB_TEMPLATE_FILE = "resources/ojb_xml.xdt";
032: private static String OJB_REPOSITORY_FILE_NAME = "repository_user.xml";
033:
034: /**
035: * Creates a new object.
036: */
037: public OjbSubTask() {
038: setTemplateURL(getClass().getResource(OJB_TEMPLATE_FILE));
039: setDestinationFile(OJB_REPOSITORY_FILE_NAME);
040: setSubTaskName("ojbrepository");
041: }
042:
043: /**
044: * Whether to generate verbose output
045: */
046: private boolean _verbose;
047:
048: /**
049: * Returns whether we generate verbose output.
050: *
051: * @return <code>true</code> if we generate verbose output
052: */
053: public boolean getVerbose() {
054: return _verbose;
055: }
056:
057: /**
058: * Specifies whether we generate verbose output.
059: *
060: * @param beVerbose Whether we generate verbose output
061: */
062: public void setVerbose(boolean beVerbose) {
063: _verbose = beVerbose;
064: }
065:
066: /**
067: * Called to validate configuration parameters.
068: *
069: * @exception XDocletException Is not thrown
070: */
071: public void validateOptions() throws XDocletException {
072: }
073:
074: /**
075: * Executes the task.
076: *
077: * @exception XDocletException If an error occurs.
078: */
079: public void execute() throws XDocletException {
080: startProcess();
081: }
082:
083: public void startProcess() throws XDocletException {
084: Log log = LogUtil.getLog(OjbSubTask.class, "startProcess");
085:
086: if (log.isDebugEnabled()) {
087: log.debug("destDir.toString()=" + getDestDir());
088: log.debug("getTemplateURL()=" + getTemplateURL());
089: log.debug("getDestinationfile()=" + getDestinationFile());
090: log.debug("getOfType()=" + getOfType());
091: log.debug("getExtent()=" + getExtent());
092: log.debug("getHavingClassTag()=" + getHavingClassTag());
093: }
094:
095: startProcessForAll();
096: }
097:
098: /**
099: * Describe what the method does
100: *
101: * @exception XDocletException
102: */
103: protected void engineStarted() throws XDocletException {
104: System.out.println("Generating ojb repository descriptor ("
105: + getDestinationFile() + ")");
106: }
107: }
|