001package org.andromda.maven.plugin.andromdapp.hibernate; 002 003import java.io.File; 004import java.util.List; 005import java.util.Map; 006 007 008/** 009 * Provides the ability to create a schema from Hibernate 010 * mapping files. 011 * 012 * @author Chad Brandon 013 */ 014public class HibernateCreateSchema 015 extends HibernateSchemaManagement 016{ 017 private static final String CREATE_OUTPUT_PATH = "createOutputPath"; 018 019 /** 020 * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#addArguments(java.util.Map, java.util.List) 021 */ 022 protected void addArguments( 023 final Map options, 024 final List<String> arguments) 025 { 026 String outputPath = this.getRequiredProperty( 027 options, 028 CREATE_OUTPUT_PATH); 029 final File file = new File(outputPath); 030 final File parent = file.getParentFile(); 031 if (parent != null) 032 { 033 parent.mkdirs(); 034 } 035 arguments.add("--output=" + outputPath); 036 arguments.add("--text"); 037 arguments.add("--quiet"); 038 arguments.add("--create"); //don't generate drop statements (the HibernateDropSchema does this) 039 } 040 041 /** 042 * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionOuputPath(java.util.Map) 043 */ 044 protected String getExecutionOuputPath(final Map options) 045 { 046 return this.getRequiredProperty( 047 options, 048 CREATE_OUTPUT_PATH); 049 } 050 051 /** 052 * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionClassName() 053 */ 054 protected String getExecutionClassName() 055 { 056 return "SchemaExport"; 057 } 058}