+ final Map settings =
+ registry.getService(ConfigurationService.class).getSettings();
+ SchemaManagementTool tool = registry.getService(SchemaManagementTool.class);
+
+ final EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.SCRIPT);
+ if ((Boolean)settings.get(EXECUTE))
+ targetTypes.add(TargetType.DATABASE);
+
+ TargetDescriptor target = new TargetDescriptor()
+ {
+ @Override
+ public EnumSet<TargetType> getTargetTypes()
+ {
+ return targetTypes;
+ }
+
+ @Override
+ public ScriptTargetOutput getScriptTargetOutput()
+ {
+ String charset =
+ (String)settings.get(AvailableSettings.HBM2DDL_CHARSET_NAME);
+ return new ScriptTargetOutputToFile(output, charset);
+ }
+ };
+
+ ExceptionHandlerCollectingImpl handler =
+ new ExceptionHandlerCollectingImpl();
+
+ ExecutionOptions options =
+ SchemaManagementToolCoordinator.buildExecutionOptions(
+ registry
+ .getService(ConfigurationService.class)
+ .getSettings(),
+ handler
+ );