HHH-13210 Don't log about running a script of type ScriptSourceInputNonExistentImpl
This commit is contained in:
parent
e8b88f5350
commit
9c63819000
|
@ -463,7 +463,6 @@ public class SchemaCreatorImpl implements SchemaCreator {
|
||||||
|
|
||||||
if ( importScriptSetting != null ) {
|
if ( importScriptSetting != null ) {
|
||||||
final ScriptSourceInput importScriptInput = interpretScriptSourceSetting( importScriptSetting, classLoaderService, charsetName );
|
final ScriptSourceInput importScriptInput = interpretScriptSourceSetting( importScriptSetting, classLoaderService, charsetName );
|
||||||
log.executingImportScript( importScriptInput.toString() );
|
|
||||||
importScriptInput.prepare();
|
importScriptInput.prepare();
|
||||||
try {
|
try {
|
||||||
for ( String command : importScriptInput.read( commandExtractor ) ) {
|
for ( String command : importScriptInput.read( commandExtractor ) ) {
|
||||||
|
@ -490,7 +489,6 @@ public class SchemaCreatorImpl implements SchemaCreator {
|
||||||
final ScriptSourceInput importScriptInput = interpretLegacyImportScriptSetting( resourceName, classLoaderService, charsetName );
|
final ScriptSourceInput importScriptInput = interpretLegacyImportScriptSetting( resourceName, classLoaderService, charsetName );
|
||||||
importScriptInput.prepare();
|
importScriptInput.prepare();
|
||||||
try {
|
try {
|
||||||
log.executingImportScript( importScriptInput.toString() );
|
|
||||||
for ( String command : importScriptInput.read( commandExtractor ) ) {
|
for ( String command : importScriptInput.read( commandExtractor ) ) {
|
||||||
applySqlString( command, formatter, options, targets );
|
applySqlString( command, formatter, options, targets );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.internal.CoreLogging;
|
||||||
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor;
|
import org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor;
|
||||||
|
import org.hibernate.tool.schema.internal.SchemaCreatorImpl;
|
||||||
import org.hibernate.tool.schema.spi.ScriptSourceInput;
|
import org.hibernate.tool.schema.spi.ScriptSourceInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,13 +23,18 @@ import org.hibernate.tool.schema.spi.ScriptSourceInput;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractScriptSourceInput implements ScriptSourceInput {
|
public abstract class AbstractScriptSourceInput implements ScriptSourceInput {
|
||||||
|
|
||||||
|
private static final CoreMessageLogger log = CoreLogging.messageLogger( SchemaCreatorImpl.class );
|
||||||
|
|
||||||
protected abstract Reader reader();
|
protected abstract Reader reader();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prepare() {
|
public void prepare() {
|
||||||
// by default there is nothing to do
|
log.executingImportScript( getScriptDescription() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract String getScriptDescription();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> read(ImportSqlCommandExtractor commandExtractor) {
|
public List<String> read(ImportSqlCommandExtractor commandExtractor) {
|
||||||
final String[] commands = commandExtractor.extractCommands( reader() );
|
final String[] commands = commandExtractor.extractCommands( reader() );
|
||||||
|
|
|
@ -56,6 +56,11 @@ public class ScriptSourceInputFromFile extends AbstractScriptSourceInput impleme
|
||||||
this.reader = toReader( file, charsetName );
|
this.reader = toReader( file, charsetName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getScriptDescription() {
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
private static Reader toReader(File file, String charsetName) {
|
private static Reader toReader(File file, String charsetName) {
|
||||||
if ( ! file.exists() ) {
|
if ( ! file.exists() ) {
|
||||||
|
|
|
@ -32,6 +32,11 @@ public class ScriptSourceInputFromReader extends AbstractScriptSourceInput imple
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getScriptDescription() {
|
||||||
|
return "[injected ScriptSourceInputFromReader script]";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ScriptSourceInputFromReader()";
|
return "ScriptSourceInputFromReader()";
|
||||||
|
|
|
@ -65,6 +65,11 @@ public class ScriptSourceInputFromUrl extends AbstractScriptSourceInput implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getScriptDescription() {
|
||||||
|
return url.toExternalForm();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -17,8 +17,9 @@ import org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ScriptSourceInput {
|
public interface ScriptSourceInput {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare source for use.
|
* Prepare source for use, and log that this script is about to be imported.
|
||||||
*/
|
*/
|
||||||
void prepare();
|
void prepare();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue