public class SchemaBootstrap
extends org.springframework.extensions.surf.util.AbstractLifecycleBean
| Modifier and Type | Class and Description |
|---|---|
class |
SchemaBootstrap.UnclosableConnection
A
Connection wrapper that delegates all calls to the wrapped class
except for the close methods, which are ignored. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LOCK_RETRY_COUNT |
static int |
DEFAULT_LOCK_RETRY_WAIT_SECONDS |
static int |
DEFAULT_MAX_STRING_LENGTH |
static int |
DEFAULT_MAX_STRING_LENGTH_NDB |
| Constructor and Description |
|---|
SchemaBootstrap() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPostCreateScriptUrl(String postUpdateScriptUrl)
Register a new script for execution after the Hibernate schema creation phase.
|
void |
addPostUpdateScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
Register a new SQL-based patch for consideration against the instance (after Hibernate execution)
|
void |
addPreCreateScriptUrl(String preCreateScriptUrl)
Register a new script for execution when creating a clean schema.
|
void |
addPreUpdateScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
Register a new SQL-based patch for consideration against the instance (before Hibernate execution)
|
void |
addUpdateActivitiScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
Register a new SQL-based patch for consideration against the Activiti instance
|
List<File> |
dumpSchema()
Produces schema dump in XML format: this is performed pre- and post-upgrade (i.e.
|
List<File> |
dumpSchema(String[] dbPrefixes)
Produces schema dump in XML format: this is performed pre- and post-upgrade (i.e.
|
static int |
getMaxStringLength() |
void |
onBootstrap(org.springframework.context.ApplicationEvent event) |
protected void |
onShutdown(org.springframework.context.ApplicationEvent event) |
void |
setAppliedPatchDAO(AppliedPatchDAO appliedPatchDAO) |
void |
setDatabaseMetaDataHelper(DatabaseMetaDataHelper databaseMetaDataHelper)
Defines the DatabaseMetaDataHelper to be used
|
void |
setDataSource(DataSource dataSource) |
void |
setDbSchemaName(String dbSchemaName)
Set db.schema.name to be used
|
void |
setDescriptorService(DescriptorService descriptorService)
Provide a reference to the DescriptorService, used to provide information
about the repository such as the database schema version number.
|
void |
setDialect(Dialect dialect)
Sets the previously auto-detected Hibernate dialect.
|
void |
setGlobalProperties(Properties globalProperties)
Sets the properties map from which we look up some configuration settings.
|
void |
setMaximumStringLength(int maximumStringLength)
Optionally override the system's default maximum string length.
|
static void |
setMaxStringLength(int length,
Dialect dialect) |
void |
setSchemaOuputFilename(String schemaOuputFilename)
Set this to output the full database creation script
|
void |
setSchemaReferenceUrls(List<String> schemaReferenceUrls)
Specifies the schema reference files that will be used to validate the repository
schema whenever changes have been made.
|
void |
setSchemaUpdateLockRetryCount(int schemaUpdateLockRetryCount)
Set the number times that the DB must be checked for the presence of the table
indicating that a schema change is in progress.
|
void |
setSchemaUpdateLockRetryWaitSeconds(int schemaUpdateLockRetryWaitSeconds)
Set the wait time (seconds) between checks for the schema update lock.
|
void |
setStopAfterSchemaBootstrap(boolean stopAfterSchemaBootstrap)
Set whether this component should terminate the bootstrap process after running all the
usual checks and scripts.
|
void |
setUpdateSchema(boolean updateSchema)
Set whether to modify the schema or not.
|
static String |
trimStringForTextFields(String value)
Truncates or returns a string that will fit into the string columns in the schema.
|
int |
validateSchema(String outputFileNameTemplate,
PrintWriter out)
Collate differences and validation problems with the schema with respect to an appropriate
reference schema.
|
public static final int DEFAULT_LOCK_RETRY_COUNT
public static final int DEFAULT_LOCK_RETRY_WAIT_SECONDS
public static final int DEFAULT_MAX_STRING_LENGTH
public static final int DEFAULT_MAX_STRING_LENGTH_NDB
public static final void setMaxStringLength(int length,
Dialect dialect)
DEFAULT_MAX_STRING_LENGTHpublic static final int getMaxStringLength()
public static final String trimStringForTextFields(String value)
DEFAULT_MAX_STRING_LENGTH.value - the string to checkgetMaxStringLength()public void setDescriptorService(DescriptorService descriptorService)
descriptorService - the descriptorService to setpublic void setDatabaseMetaDataHelper(DatabaseMetaDataHelper databaseMetaDataHelper)
databaseMetaDataHelper - DatabaseMetaDataHelperpublic void setDialect(Dialect dialect)
dialect - the dialectpublic void setDataSource(DataSource dataSource)
public void setAppliedPatchDAO(AppliedPatchDAO appliedPatchDAO)
public void setSchemaOuputFilename(String schemaOuputFilename)
schemaOuputFilename - the name of a file to dump the schema to, or null to ignorepublic void setUpdateSchema(boolean updateSchema)
updateSchema - true to update and validate the schema, otherwise false to just
validate the schema. Default is true.public void setStopAfterSchemaBootstrap(boolean stopAfterSchemaBootstrap)
WARNING: USE FOR DEBUG AND UPGRADE TESTING ONLY
stopAfterSchemaBootstrap - true to terminate (with exception) after
running all the usual schema updates and checks.public void setSchemaReferenceUrls(List<String> schemaReferenceUrls)
schemaReferenceUrls - the schemaReferenceUrls to setPLACEHOLDER_DIALECTpublic void setSchemaUpdateLockRetryCount(int schemaUpdateLockRetryCount)
schemaUpdateLockRetryCount - the number of times to retry (default 24)public void setSchemaUpdateLockRetryWaitSeconds(int schemaUpdateLockRetryWaitSeconds)
schemaUpdateLockRetryWaitSeconds - the number of seconds between checks (default 5 seconds)public void setMaximumStringLength(int maximumStringLength)
The system - as of V2.1.2 - will attempt to adjust the maximum string length size automatically and therefore this method is not normally required. But it is possible to manually override the value if, for example, the system doesn't guess the correct maximum length or if the dialect is not explicitly catered for.
All negative or zero values are ignored and the system defaults to its best guess based on the dialect being used.
maximumStringLength - the maximum length of the string_value columnspublic void setDbSchemaName(String dbSchemaName)
public void setGlobalProperties(Properties globalProperties)
globalProperties - the global propertiespublic void addPreCreateScriptUrl(String preCreateScriptUrl)
preCreateScriptUrl - the script URL, possibly containing the ${db.script.dialect} placeholderpublic void addPostCreateScriptUrl(String postUpdateScriptUrl)
postUpdateScriptUrl - the script URL, possibly containing the ${db.script.dialect} placeholderpublic void addPreUpdateScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
scriptPatch - the patch that will be examined for executionpublic void addPostUpdateScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
scriptPatch - the patch that will be examined for executionpublic void addUpdateActivitiScriptPatch(SchemaUpgradeScriptPatch scriptPatch)
scriptPatch - the patch that will be examined for executionpublic void onBootstrap(org.springframework.context.ApplicationEvent event)
onBootstrap in class org.springframework.extensions.surf.util.AbstractLifecycleBeanpublic int validateSchema(String outputFileNameTemplate, PrintWriter out)
outputFileNameTemplate - Stringout - PrintWriterpublic List<File> dumpSchema()
public List<File> dumpSchema(String[] dbPrefixes)
dbPrefixes - Array of database object prefixes to produce the dump for, e.g. "alf_".protected void onShutdown(org.springframework.context.ApplicationEvent event)
onShutdown in class org.springframework.extensions.surf.util.AbstractLifecycleBeanCopyright © 2005–2018 Alfresco Software. All rights reserved.