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 create a schema from Hibernate
09: * mapping files.
10: *
11: * @author Chad Brandon
12: */
13: public class HibernateCreateSchema extends HibernateSchemaManagement {
14: private static final String CREATE_OUTPUT_PATH = "createOutputPath";
15:
16: /**
17: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#addArguments(java.util.Map, java.util.List)
18: */
19: protected void addArguments(final Map options, final List arguments) {
20: String outputPath = this .getRequiredProperty(options,
21: CREATE_OUTPUT_PATH);
22: final File file = new File(outputPath);
23: final File parent = file.getParentFile();
24: if (parent != null) {
25: parent.mkdirs();
26: }
27: arguments.add("--output=" + outputPath);
28: arguments.add("--text");
29: arguments.add("--quiet");
30: arguments.add("--create"); //don't generate drop statements (the HibernateDropSchema does this)
31: }
32:
33: /**
34: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionOuputPath(java.util.Map)
35: */
36: protected String getExecutionOuputPath(final Map options) {
37: return this .getRequiredProperty(options, CREATE_OUTPUT_PATH);
38: }
39:
40: /**
41: * @see org.andromda.maven.plugin.andromdapp.hibernate.HibernateSchemaManagement#getExecutionClassName()
42: */
43: protected String getExecutionClassName() {
44: return "SchemaExport";
45: }
46: }
|