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    * Provides the ability to drop a schema from Hibernate
9    * mapping files.
10   *
11   * @author Chad Brandon
12   */
13  public class HibernateDropSchema
14      extends HibernateSchemaManagement
15  {
16      /**
17       * The drop output path.
18       */
19      private static final String DROP_OUTPUT_PATH = "dropOutputPath";
20  
21      /**
22       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#addArguments(Map, List)
23       */
24      protected void addArguments(
25          final Map options,
26          final List<String> arguments)
27      {
28          final String outputPath = this.getRequiredProperty(
29              options,
30              DROP_OUTPUT_PATH);
31          final File file = new File(outputPath);
32          final File parent = file.getParentFile();
33          if (parent != null)
34          {
35              parent.mkdirs();
36          }
37          arguments.add("--output=" + outputPath);
38          arguments.add("--text");
39          arguments.add("--quiet");
40          arguments.add("--drop");
41      }
42  
43      /**
44       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionOuputPath(java.util.Map)
45       */
46      protected String getExecutionOuputPath(final Map options)
47      {
48          return this.getRequiredProperty(
49              options,
50              DROP_OUTPUT_PATH);
51      }
52  
53      /**
54       * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionClassName()
55       */
56      protected String getExecutionClassName()
57      {
58          return "SchemaExport";
59      }
60  }