001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.apache.torque.mojo;
017    
018    import org.apache.maven.plugin.MojoExecutionException;
019    import org.kuali.core.db.torque.KualiTorqueSchemaDumpTask;
020    
021    /**
022     * Examines the JDBC metadata of a proprietary database and exports the schema information to database agnostic XML. The
023     * generated XML contains information about tables, primary keys, unique constraints, foreign keys, indexes, sequences,
024     * and views. This goal does not export any data. See also <code>impex:exportdata</code> and <code>impex:import</code>
025     * 
026     * @goal exportschema
027     * @phase generate-sources
028     */
029    public class ExportSchemaMojo extends ExportMojo {
030    
031            /**
032             * Flag indicating whether or not tables will be processed. Default is true
033             * 
034             * @parameter expression="${processTables}" default-value="true"
035             */
036            private boolean processTables;
037    
038            /**
039             * Flag indicating whether or not views will be processed. Default is true
040             * 
041             * @parameter expression="${processViews}" default-value="true"
042             */
043            private boolean processViews;
044    
045            /**
046             * Flag indicating whether or not sequences will be processed. Default is true
047             * 
048             * @parameter expression="${processSequences}" default-value="true"
049             */
050            private boolean processSequences;
051    
052            /**
053             * The file that the schema XML will get written to
054             * 
055             * @parameter expression="${schemaXMLFile}" default-value="${basedir}/src/main/impex/${project.artifactId}.xml"
056             * @required
057             */
058            private String schemaXMLFile;
059    
060            /**
061             * Configure the Ant task
062             */
063            protected void configureTask() throws MojoExecutionException {
064    
065                    KualiTorqueSchemaDumpTask task = new KualiTorqueSchemaDumpTask();
066                    setAntTask(task);
067                    super.configureTask();
068            }
069    
070            public boolean isProcessTables() {
071                    return processTables;
072            }
073    
074            public void setProcessTables(boolean processTables) {
075                    this.processTables = processTables;
076            }
077    
078            public boolean isProcessViews() {
079                    return processViews;
080            }
081    
082            public void setProcessViews(boolean processViews) {
083                    this.processViews = processViews;
084            }
085    
086            public boolean isProcessSequences() {
087                    return processSequences;
088            }
089    
090            public void setProcessSequences(boolean processSequences) {
091                    this.processSequences = processSequences;
092            }
093    
094            public String getSchemaXMLFile() {
095                    return schemaXMLFile;
096            }
097    
098            public void setSchemaXMLFile(String schemaXMLFile) {
099                    this.schemaXMLFile = schemaXMLFile;
100            }
101    
102    }