public class DbUpdaterEngine extends java.lang.Object implements DbUpdater
Modifier and Type | Class and Description |
---|---|
static interface |
DbUpdaterEngine.FileHandler |
static class |
DbUpdaterEngine.ScriptSplitter |
Modifier and Type | Field and Description |
---|---|
protected boolean |
changelogTableExists |
protected javax.sql.DataSource |
dataSource |
protected java.lang.String |
dbmsType |
protected java.lang.String |
dbmsVersion |
protected java.lang.String |
dbScriptsDirectory |
protected static java.lang.String |
ERROR |
protected static java.util.List<java.util.regex.Pattern> |
EXCLUDED_ADDONS |
protected java.util.Map<java.lang.String,DbUpdaterEngine.FileHandler> |
extensionHandlers |
protected static org.slf4j.Logger |
log |
protected static java.util.regex.Pattern |
RESTAPI_REGEX |
protected boolean |
scriptsExists |
protected java.lang.String |
storeName |
protected static java.lang.String |
UPGRADE_GROOVY_EXTENSION |
Modifier | Constructor and Description |
---|---|
protected |
DbUpdaterEngine() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
containsIgnoringPrefix(java.util.Collection<java.lang.String> strings,
java.lang.String s) |
protected void |
createChangelogTable() |
boolean |
dbInitialized() |
protected java.lang.String |
dbScriptDirectoryPath() |
protected java.lang.String |
distinguishingSubstring(java.lang.String scriptName) |
protected void |
doInit() |
protected void |
doUpdate() |
protected boolean |
executeGroovyScript(ScriptResource file) |
protected boolean |
executeScript(ScriptResource file) |
protected void |
executeSql(java.lang.String sql) |
protected boolean |
executeSqlScript(ScriptResource file) |
protected boolean |
filterInitScript(ScriptResource scriptResource) |
java.util.List<java.lang.String> |
findUpdateDatabaseScripts() |
protected java.lang.String |
getConnectionUrl(java.sql.Connection connection) |
protected javax.sql.DataSource |
getDataSource() |
protected java.util.Set<java.lang.String> |
getExecutedScripts() |
protected java.util.List<ScriptResource> |
getInitScripts() |
protected java.util.List<ScriptResource> |
getInitScripts(java.lang.String oneModuleDir) |
protected java.util.List<java.lang.String> |
getModuleDirs() |
protected java.lang.String |
getScriptName(ScriptResource resource) |
protected java.lang.String |
getScriptName(java.lang.String path) |
java.util.List<ScriptResource> |
getScripts(ScriptType scriptType,
java.lang.String moduleName) |
protected java.util.List<ScriptResource> |
getUpdateScripts() |
protected java.util.List<ScriptResource> |
getUpdateScripts(java.lang.String oneModuleDir) |
protected boolean |
initializedByOwnScript(java.util.Set<java.lang.String> executedScripts,
java.lang.String dirName) |
protected boolean |
isEmpty(java.lang.String sql) |
protected void |
markScript(java.lang.String name,
boolean init) |
protected void |
prepareScripts()
Mark all SQL updates scripts as evaluated
Try to execute Groovy scripts
|
protected void |
runRequiredInitScripts() |
protected ScriptScanner |
scriptScanner() |
void |
updateDatabase() |
protected static final java.lang.String UPGRADE_GROOVY_EXTENSION
protected static final java.util.regex.Pattern RESTAPI_REGEX
protected static final java.util.List<java.util.regex.Pattern> EXCLUDED_ADDONS
protected static final java.lang.String ERROR
protected static final org.slf4j.Logger log
protected javax.sql.DataSource dataSource
protected java.lang.String dbScriptsDirectory
protected java.lang.String storeName
protected java.lang.String dbmsType
protected java.lang.String dbmsVersion
protected boolean changelogTableExists
protected boolean scriptsExists
protected final java.util.Map<java.lang.String,DbUpdaterEngine.FileHandler> extensionHandlers
protected javax.sql.DataSource getDataSource()
public java.util.List<ScriptResource> getScripts(ScriptType scriptType, @Nullable java.lang.String moduleName)
public void updateDatabase() throws DbInitializationException
updateDatabase
in interface DbUpdater
DbInitializationException
public java.util.List<java.lang.String> findUpdateDatabaseScripts() throws DbInitializationException
findUpdateDatabaseScripts
in interface DbUpdater
DbInitializationException
protected ScriptScanner scriptScanner()
protected java.lang.String dbScriptDirectoryPath()
protected void createChangelogTable()
protected java.lang.String getScriptName(ScriptResource resource)
protected java.lang.String getScriptName(java.lang.String path)
public boolean dbInitialized() throws DbInitializationException
dbInitialized
in interface DbUpdater
DbInitializationException
protected void doInit()
protected void doUpdate()
protected void runRequiredInitScripts()
protected boolean filterInitScript(ScriptResource scriptResource)
protected boolean initializedByOwnScript(java.util.Set<java.lang.String> executedScripts, java.lang.String dirName)
protected boolean containsIgnoringPrefix(java.util.Collection<java.lang.String> strings, java.lang.String s)
protected java.lang.String distinguishingSubstring(java.lang.String scriptName)
protected void prepareScripts()
protected java.util.Set<java.lang.String> getExecutedScripts()
protected void markScript(java.lang.String name, boolean init)
protected boolean isEmpty(java.lang.String sql)
protected boolean executeSqlScript(ScriptResource file)
protected void executeSql(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
protected boolean executeGroovyScript(ScriptResource file)
protected boolean executeScript(ScriptResource file)
protected java.util.List<java.lang.String> getModuleDirs()
protected java.util.List<ScriptResource> getInitScripts()
protected java.util.List<ScriptResource> getInitScripts(@Nullable java.lang.String oneModuleDir)
protected java.util.List<ScriptResource> getUpdateScripts()
protected java.util.List<ScriptResource> getUpdateScripts(@Nullable java.lang.String oneModuleDir)
protected java.lang.String getConnectionUrl(java.sql.Connection connection)