Class SchemaCompatibiltyUtility
java.lang.Object
com.broadleafcommerce.common.jpa.schema.SchemaCompatibiltyUtility
Utility for exporting a generated schema from emitted persistence configuration via ORM (from
entity metadata) to a Liquibase change log xml file. This utility furthermore has validation
functionality. Here's a list of the specific features.
- Generate a change log - used to create a new change log xml for the entities known to Spring and ORM at runtime.
- Generate diff - used to append delta change sets to a previous change log from the most recent state of entities known to Spring and ORM at runtime.
- Validate release - used to confirm a change log is up-to-date with the most recent state of entities known to Spring and ORM at runtime. This can also serve as an extra checkpoint to detect unknown entity changes that would affect the schema requirements for a release - especially a patch release, which should not have deltas here.
- Postgres >= 9.2
- Oracle >= 12cR1
- MySql >= 8
- Mariadb >= 10.2.2
- Author:
- Jeff Fischer
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Spring environment initializer.static class
static class
static class
static class
A modified Mariadb ORM dialect describing any Broadleaf specific schema generation requirements for JPA entities.static class
static class
A modified Mysql ORM dialect describing any Broadleaf specific schema generation requirements for JPA entities.static class
A modified Oracle ORM dialect describing any Broadleaf specific schema generation requirements for JPA entities.static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
generateLog
(org.springframework.context.ApplicationContext appctx) Generate a change log xml file based on the current entity configuration known to Spring and the ORM.static void
initializeOracleUser
(String sysPassword, String jdbcUrl, String newUser, String newPassword) static void
mariaSetup
(String jdbcUrl, String userName, String password, String databaseName) Mariadb platform specific setup method that establishes base configuration for execution.static void
mySqlSetup
(String jdbcUrl, String userName, String password, String databaseName) Mysql platform specific setup method that establishes base configuration for execution.static void
oracleSetup
(String jdbcUrl, String userName, String password) Oracle platform specific setup method that establishes base configuration for execution.static void
postgresSetup
(String jdbcUrl, String userName, String password, String databaseName) Postgres platform specific setup method that establishes base configuration for execution.static void
Short-version setup method that establishes base configuration for execution.static void
setup
(String jdbcUrl, String userName, String password, String driverClassname, String dialect, String platform, String databaseName) Catch-all setup method that establishes base configuration for execution.static void
validateForRelease
(org.springframework.context.ApplicationContext appctx) During a release, we expect to find a existing changelog file in the codebase, and we expect that file to be up-to-date with the current entities that Spring and the ORM are aware of at runtime.static void
yugabyteSetup
(String jdbcUrl, String userName, String password, String databaseName)
-
Field Details
-
IGNORE_VALIDATION
- See Also:
-
-
Method Details
-
validateForRelease
public static void validateForRelease(org.springframework.context.ApplicationContext appctx) throws Exception During a release, we expect to find a existing changelog file in the codebase, and we expect that file to be up-to-date with the current entities that Spring and the ORM are aware of at runtime. This utility method performs that check and will throw an IllegalStateException should that validation fail.- Parameters:
appctx
- The spring application context- Throws:
Exception
- Any exception occurring during the validation, including an IllegalStateException.
-
setup
public static void setup(String jdbcUrl, String userName, String password, String driverClassname, String dialect, String platform, String databaseName) Catch-all setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for logindriverClassname
- The jdbc driver classdialect
- The ORM dialect class nameplatform
- The Liquibase short name for the database platformdatabaseName
- The name of the database connecting to. This is the target schema for mysql, mariadb, and oracle. This is the target catalog for postgres.
-
setup
Short-version setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for logindatabaseName
- The name of the database connecting to. This is the target schema for mysql, mariadb, and oracle. This is the target catalog for postgres.
-
mySqlSetup
public static void mySqlSetup(String jdbcUrl, String userName, String password, String databaseName) Mysql platform specific setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for logindatabaseName
- The name of the database connecting to. This is the target schema for mysql, mariadb, and oracle. This is the target catalog for postgres.
-
mariaSetup
public static void mariaSetup(String jdbcUrl, String userName, String password, String databaseName) Mariadb platform specific setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for logindatabaseName
- The name of the database connecting to. This is the target schema for mysql, mariadb, and oracle. This is the target catalog for postgres.
-
oracleSetup
Oracle platform specific setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for login
-
postgresSetup
public static void postgresSetup(String jdbcUrl, String userName, String password, String databaseName) Postgres platform specific setup method that establishes base configuration for execution.- Parameters:
jdbcUrl
- The jdbc url for connecting to the target database for schema generationuserName
- The login usernamepassword
- The password for logindatabaseName
- The name of the database connecting to. This is the target schema for mysql, mariadb, and oracle. This is the target catalog for postgres.
-
yugabyteSetup
-
generateLog
public static void generateLog(org.springframework.context.ApplicationContext appctx) throws Exception Generate a change log xml file based on the current entity configuration known to Spring and the ORM. If no file currently exists, a new one will be created. If a file already exists, any deltas from the current know state and that described in the change log file are added to the change log file. If the change log file is up-to-date, it is left alone.- Parameters:
appctx
- The spring application context- Throws:
Exception
- Any exception occurring during the change log generation
-
initializeOracleUser
-