View Javadoc
1   package org.andromda.maven.plugin.andromdapp.hibernate;
2   
3   import java.io.File;
4   import java.util.List;
5   import java.util.Map;
6   
7   
8   /**
9    * Provides the ability to create a schema from Hibernate
10   * mapping files.
11   *
12   * @author Chad Brandon
13   */
14  public class HibernateCreateSchema
15      extends HibernateSchemaManagement
16  {
17      private static final String CREATE_OUTPUT_PATH = "createOutputPath";
18  
19      /**
20       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#addArguments(java.util.Map, java.util.List)
21       */
22      protected void addArguments(
23          final Map options,
24          final List<String> arguments)
25      {
26          String outputPath = this.getRequiredProperty(
27              options,
28              CREATE_OUTPUT_PATH);
29          final File file = new File(outputPath);
30          final File parent = file.getParentFile();
31          if (parent != null)
32          {
33              parent.mkdirs();
34          }
35          arguments.add("--output=" + outputPath);
36          arguments.add("--text");
37          arguments.add("--quiet");
38          arguments.add("--create"); //don't generate drop statements (the HibernateDropSchema does this)
39      }
40  
41      /**
42       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionOuputPath(java.util.Map)
43       */
44      protected String getExecutionOuputPath(final Map options)
45      {
46          return this.getRequiredProperty(
47              options,
48              CREATE_OUTPUT_PATH);
49      }
50  
51      /**
52       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionClassName()
53       */
54      protected String getExecutionClassName()
55      {
56          return "SchemaExport";
57      }
58  }