projects
/
hibernate4-maven-plugin
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WIP
[hibernate4-maven-plugin]
/
src
/
main
/
java
/
de
/
juplo
/
plugins
/
hibernate
/
UpdateMojo.java
diff --git
a/src/main/java/de/juplo/plugins/hibernate/UpdateMojo.java
b/src/main/java/de/juplo/plugins/hibernate/UpdateMojo.java
index
09b74a3
..
6d9e62e
100644
(file)
--- a/
src/main/java/de/juplo/plugins/hibernate/UpdateMojo.java
+++ b/
src/main/java/de/juplo/plugins/hibernate/UpdateMojo.java
@@
-16,8
+16,8
@@
package de.juplo.plugins.hibernate;
* limitations under the License.
*/
* limitations under the License.
*/
+import java.io.File;
import java.util.EnumSet;
import java.util.EnumSet;
-import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@
-70,17
+70,22
@@
public class UpdateMojo extends AbstractSchemaMojo
@Override
@Override
- ExceptionHandlerCollectingImpl build(MetadataImplementor metadata)
+ ExceptionHandlerCollectingImpl build(
+ final MetadataImplementor metadata,
+ final File output
+ )
throws
MojoExecutionException,
MojoFailureException
{
throws
MojoExecutionException,
MojoFailureException
{
- final ServiceRegistry
service
=
+ final ServiceRegistry
registry
=
metadata.getMetadataBuildingOptions().getServiceRegistry();
metadata.getMetadataBuildingOptions().getServiceRegistry();
- SchemaManagementTool tool = service.getService(SchemaManagementTool.class);
+ final Map settings =
+ registry.getService(ConfigurationService.class).getSettings();
+ SchemaManagementTool tool = registry.getService(SchemaManagementTool.class);
final EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.SCRIPT);
final EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.SCRIPT);
- if (
execute
)
+ if (
(Boolean)settings.get(EXECUTE)
)
targetTypes.add(TargetType.DATABASE);
TargetDescriptor target = new TargetDescriptor()
targetTypes.add(TargetType.DATABASE);
TargetDescriptor target = new TargetDescriptor()
@@
-94,25
+99,27
@@
public class UpdateMojo extends AbstractSchemaMojo
@Override
public ScriptTargetOutput getScriptTargetOutput()
{
@Override
public ScriptTargetOutput getScriptTargetOutput()
{
- String charset
- = (String) service
- .getService(ConfigurationService.class)
- .getSettings()
- .get(AvailableSettings.HBM2DDL_CHARSET_NAME);
+ String charset =
+ (String)settings.get(AvailableSettings.HBM2DDL_CHARSET_NAME);
return new ScriptTargetOutputToFile(output, charset);
}
};
return new ScriptTargetOutputToFile(output, charset);
}
};
+ ExceptionHandlerCollectingImpl handler =
+ new ExceptionHandlerCollectingImpl();
+
ExecutionOptions options =
SchemaManagementToolCoordinator.buildExecutionOptions(
ExecutionOptions options =
SchemaManagementToolCoordinator.buildExecutionOptions(
- service
+ registry
.getService(ConfigurationService.class)
.getSettings(),
.getService(ConfigurationService.class)
.getSettings(),
- new ExceptionHandlerCollectingImpl()
+ handler
);
Map config = options.getConfigurationValues();
tool.getSchemaMigrator(config).doMigration(metadata, options, target);
);
Map config = options.getConfigurationValues();
tool.getSchemaMigrator(config).doMigration(metadata, options, target);
+
+ return handler;
}
}
}
}