Skip to main content
Version: 8.6.x

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.

  1. To override the functionality of the oracle.sproc initialization script and to continue using the oracle-service.properties URLs, use a database type oracle-service-myproject.

  2. Add an oracle-service-myproject.sproc file to the src/main/resources/database-reset-sql/ module.

Creating New Data Set​

Use this procedure to create a new rel-1.x data set directory.

  1. Copy template/data-template/ to the data directory and rename it to rel-1.x-data.

  2. In data/rel-1.x-data/, replace all instances of @new-data-dir with rel-1.x-data.

  3. In data/liquibase-changelog.xml file, add the following before the include paths for test-data: <include file="rel-1.x-data/liquibase-changelog.xml" relativeToChangelogFile="true" /> config/filtering.properties.

  4. In the /filtering.properties file 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.

  1. Navigate to the extensions/data-population/ext-data-population-maven-plugin module, 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 directory

      Ensure that the workingDirectory does 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:

  • DataPopulationCliApplication
  • DataPopulationCliApplicationInitializer
  • DataPopulationCliGlobalConfigurer
  • CommandAvailabilityChecker

*-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:

  • DataDirectoryConfiguration
  • EnvironmentDirectoryConfiguration

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.sh
  • data-population.bat