Extending Data Population Tool
Data Population Tool Resources
For Self-Managed Commerce, the following data population modules are included in your development environment:
ext-data
Contains Liquibase and import/export data, schema, and environment specific properties.
ext-database-update
Executes the Data Population Maven plug-in with either the reset-db or update-db commands. For more information, see Maven Plug-in for Data Population section below.
ext-schema-documentation
Generates SchemaSpy documentation.
Extending Database Configurations
You can extend the database configuration by using a new database type and adding the corresponding configuration files to the src/main/resources/database-reset-sql/ or src/main/resources/database-url/ modules in the extensions/data-population/ext-data-population-core module .
For more information about configurations and types, see Data Population Core Configurations. Use this example procedure to extend an Oracle database.
-
To override the functionality of the
oracle.sprocinitialization script and to continue using theoracle-service.propertiesURLs, use a database typeoracle-service-myproject. -
Add an
oracle-service-myproject.sprocfile to thesrc/main/resources/database-reset-sql/module.
Creating New Data Set
Use this procedure to create a new rel-1.x data set directory.
-
Copy
template/data-template/to thedatadirectory and rename it torel-1.x-data. -
In
data/rel-1.x-data/, replace all instances of@new-data-dirwithrel-1.x-data. -
In
data/liquibase-changelog.xmlfile, add the following before the include paths for test-data:<include file="rel-1.x-data/liquibase-changelog.xml" relativeToChangelogFile="true" /> config/filtering.properties. -
In the
/filtering.propertiesfile for each environment, override the default qualifier to run import on every database update:importexport.rel-1.x-data.qualifier=${timestamp.qualifier}
Do this step for the local environment and for other environments to rerun import on a database update.
Maven Plug-in for Data Population
The extensions/data-population/ext-data-population-maven-plugin module consists of the Maven plug-in for data population.
-
Navigate to the
extensions/data-population/ext-data-population-maven-pluginmodule, and run the following command:mvn clean install -Pupdate-db <directory name>For
<directory name>, specify one of the following:-
dataDirectory: Specifies the path to the data directory -
configDirectory: Specifies the path to the environment configuration directory -
workingDirectory: Specifies path to the working directoryEnsure that the
workingDirectorydoes not point to a directory with any critical files because data is cleared when data population is run. -
outputDirectory: Specifies the path to the directory containing the data filtering output
-
Data Population CLI Tool Extension Modules
Any project-specific customizations must be made in project-specific modules, and then add to the class path of the assembled CLI tool of the project. You can extend or customize the following modules in Data Population CLI Tool:
ep-data-population-cli-tool
Provides the CLI entry point, DataPopulationCliApplication, and the global configuration option annotations and processors.
Significant Classes:
DataPopulationCliApplicationDataPopulationCliApplicationInitializerDataPopulationCliGlobalConfigurerCommandAvailabilityChecker
*-directory-plugin
Configures the global configuration options to system properties so that the Spring Shell can initialize the application context with these directory resources.
Significant Classes:
DataDirectoryConfigurationEnvironmentDirectoryConfiguration
ep-dp-cli-database-reset-plugin
Provides the reset-db command to delete, recreate, and repopulate the database. High-level command which calls the data-population core.
Significant Classes:
DatabaseResetCommand
ep-dp-cli-database-update-plugin
Provides the update-db command which repopulates the database, updates the schema, and runs data import as change sets.
Significant Classes:
DatabaseUpdateCommand
ep-dp-cli-filter-data-plugin
Provides the filter-data command which uses the low-level filter service to filter the data into an output directory.
Significant Classes:
FilterDataCommand
ep-data-population-cli-tool-assembly
Assembles up the data population tool. This module contains shell script wrappers to invoke the tool.
Significant Classes:
data-population.shdata-population.bat