Coverage Report - org.apache.torque.mojo.SqlMojoBase
 
Classes in this File Line Coverage Branch Coverage Complexity
SqlMojoBase
0%
0/15
0%
0/2
1.25
 
 1  
 package org.apache.torque.mojo;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.File;
 23  
 
 24  
 import org.apache.commons.configuration.PropertiesConfiguration;
 25  
 import org.apache.maven.plugin.MojoExecutionException;
 26  
 import org.apache.tools.ant.types.FileSet;
 27  
 import org.kuali.core.db.torque.KualiTorqueSQLTask;
 28  
 
 29  
 /**
 30  
  * Generates SQL from schema.xml files
 31  
  */
 32  
 public abstract class SqlMojoBase extends DataModelTaskMojo {
 33  
 
 34  
         /**
 35  
          * Creates a new SQLMojo object.
 36  
          */
 37  0
         public SqlMojoBase() {
 38  0
                 setAntTask(new KualiTorqueSQLTask());
 39  0
         }
 40  
 
 41  
         /**
 42  
          * Returns the context properties for the Texen task.
 43  
          * 
 44  
          * @return The PropertiesConfiguration containing all context properties, not null.
 45  
          */
 46  
         protected PropertiesConfiguration getMojoContextProperties() {
 47  0
                 PropertiesConfiguration configuration = new PropertiesConfiguration();
 48  0
                 configuration.addProperty(TARGET_DATABASE_CONTEXT_PROPERTY, super.getTargetDatabase());
 49  0
                 return configuration;
 50  
         }
 51  
 
 52  
         /**
 53  
          * Returns the path to the control template.
 54  
          * 
 55  
          * @return "sql/base/Control.vm"
 56  
          */
 57  
         protected String getControlTemplate() {
 58  0
                 return "sql/base/Control.vm";
 59  
         }
 60  
 
 61  
         /**
 62  
          * Configures the Texen task wrapped by this mojo
 63  
          */
 64  
         protected void configureTask() throws MojoExecutionException {
 65  0
                 super.configureTask();
 66  
 
 67  0
                 KualiTorqueSQLTask task = (KualiTorqueSQLTask) super.getGeneratorTask();
 68  
 
 69  0
                 if (getSuffix() != null) {
 70  0
                         getLog().debug("Adding suffix: " + getSuffix());
 71  0
                         task.setSuffix(getSuffix());
 72  
                 }
 73  0
                 FileSet fileSet = getAntFileSet(new File(getSchemaDir()), getSchemaIncludes(), getSchemaExcludes());
 74  0
                 task.addFileset(fileSet);
 75  0
         }
 76  
 
 77  
 }