1 /** 2 * Copyright 2004-2012 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.torque.mojo; 17 18 import org.apache.maven.plugin.MojoExecutionException; 19 import org.kuali.core.db.torque.KualiTorqueSchemaDumpTask; 20 21 /** 22 * Examines the JDBC metadata of a proprietary database and exports the schema information to database agnostic XML. The 23 * generated XML contains information about tables, primary keys, unique constraints, foreign keys, indexes, sequences, 24 * and views. This goal does not export any data. See also <code>impex:exportdata</code> and <code>impex:import</code> 25 * 26 * @goal exportschema 27 * @phase generate-sources 28 */ 29 public class ExportSchemaMojo extends ExportMojo { 30 31 /** 32 * Flag indicating whether or not tables will be processed. Default is true 33 * 34 * @parameter expression="${processTables}" default-value="true" 35 */ 36 private boolean processTables; 37 38 /** 39 * Flag indicating whether or not views will be processed. Default is true 40 * 41 * @parameter expression="${processViews}" default-value="true" 42 */ 43 private boolean processViews; 44 45 /** 46 * Flag indicating whether or not sequences will be processed. Default is true 47 * 48 * @parameter expression="${processSequences}" default-value="true" 49 */ 50 private boolean processSequences; 51 52 /** 53 * The file that the schema XML will get written to 54 * 55 * @parameter expression="${schemaXMLFile}" default-value="${basedir}/src/main/impex/${project.artifactId}.xml" 56 * @required 57 */ 58 private String schemaXMLFile; 59 60 /** 61 * Configure the Ant task 62 */ 63 protected void configureTask() throws MojoExecutionException { 64 65 KualiTorqueSchemaDumpTask task = new KualiTorqueSchemaDumpTask(); 66 setAntTask(task); 67 super.configureTask(); 68 } 69 70 public boolean isProcessTables() { 71 return processTables; 72 } 73 74 public void setProcessTables(boolean processTables) { 75 this.processTables = processTables; 76 } 77 78 public boolean isProcessViews() { 79 return processViews; 80 } 81 82 public void setProcessViews(boolean processViews) { 83 this.processViews = processViews; 84 } 85 86 public boolean isProcessSequences() { 87 return processSequences; 88 } 89 90 public void setProcessSequences(boolean processSequences) { 91 this.processSequences = processSequences; 92 } 93 94 public String getSchemaXMLFile() { 95 return schemaXMLFile; 96 } 97 98 public void setSchemaXMLFile(String schemaXMLFile) { 99 this.schemaXMLFile = schemaXMLFile; 100 } 101 102 }