01: package org.andromda.maven.plugin.andromdapp.hibernate;
02:
03: import java.io.File;
04: import java.util.List;
05: import java.util.Map;
06:
07: /**
08: * Provides the ability to drop a schema from Hibernate
09: * mapping files.
10: *
11: * @author Chad Brandon
12: */
13: public class HibernateDropSchema extends HibernateSchemaManagement {
14: /**
15: * The drop output path.
16: */
17: private static final String DROP_OUTPUT_PATH = "dropOutputPath";
18:
19: /**
20: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#addArguments(java.util.List)
21: */
22: protected void addArguments(final Map options, final List arguments) {
23: final String outputPath = this .getRequiredProperty(options,
24: DROP_OUTPUT_PATH);
25: final File file = new File(outputPath);
26: final File parent = file.getParentFile();
27: if (parent != null) {
28: parent.mkdirs();
29: }
30: arguments.add("--output=" + outputPath);
31: arguments.add("--text");
32: arguments.add("--quiet");
33: arguments.add("--drop");
34: }
35:
36: /**
37: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionOuputPath(java.util.Map)
38: */
39: protected String getExecutionOuputPath(final Map options) {
40: return this .getRequiredProperty(options, DROP_OUTPUT_PATH);
41: }
42:
43: /**
44: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionClassName()
45: */
46: protected String getExecutionClassName() {
47: return "SchemaExport";
48: }
49: }
|