Cockpit Configuration Migration Tool

You can migrate the existing cockpit UI Configurations using the easy migration tool. It parses the UI Configuration ImpEx scripts and creates a configuration structure ready to be used with cockpit's automatic configuration loading mechanism. Configuration from the old ImpEx files need to be transformed to the proper folder structure. Also, all the XML files with configuration data need to be copied to the new localization.

Introduction

The migration tool was created as an ant task, placed in the buildcallbacks.xml file for the cockpit extensions. The target is named migrate_cockpit_config and need to be called from the command line, under the root folder of extension you want to migrate. The migration script creates a new folder structure, according to the proper convention. New configuration structure is ready to be used with the cockpit's automatic configuration loading mechanism.

Input Parameters

Migration Script Syntax

migrate_cockpit_config [-p REL_START_PATH] [-e IMPEX_FILE_EXT ... | -f IMPEX_FILE_NAME ...] [-d DEST_DIRECTORY]

Field

Flag

Description

Default

migrate_cockpit_config

Ant's target name

REL_START_PATH

-p

Path relative to the current directory where we should start looking for ImpEx scripts

.

IMPEX_FILE_EXT

-e

File extension of the ImpEx scripts we want to use, for example csv, impex, txt. This field prevail over IMPEX_FILE_NAME.

csv

IMPEX_FILE_NAME

-f

File name, without the path, of the ImpEx script we want to use, for example the ui_components.csv file. While using IMPEX_FILE_EXT at the same time, this field is ignored.

csv extension is used

DEST_DIRECTORY

-d

Destination path, that is the place where the new configuration directory should be placed.

extensionname/resources

Migration Script Usage

To create proper command for executing, you need to use property values using -D flag.

Example of a typical call:

ant migrate_cockpit_config -De="impex,csv"

More than one file name or extension for the -Df and -De flags need to be placed in quotation marks and be separated by a coma. In case you create properties for both IMPEX_FILE_EXT and IMPEX_FILE_NAME, the value for file extension is used.

Examples

  • D:\Workspace\bin\ext-hybris\printcockpit>ant migrate_cockpit_configuration

    Structure is created using default values, listed in the syntax table. The script searches for all the CSV files in the folders under the current one. New structure is placed under the /resources folder.

  • D:\Workspace\bin\ext-hybris\printcockpit>ant migrate_cockpit_configuration -Dp=resources -Dd=resources/localization

    In this case the script looks for the CSV files in the |extensionname|/resources folder, and the new configuration is placed under the localization folder. Note, that this is not valid localization for configuration files. Import from path resources/localization is not in accordance with the proper convention.

  • D:\Workspace\bin\ext-hybris\printcockpit>ant migrate_cockpit_configuration -Df="ui_components.csv,ui_data.impex" -Dd=resources

    The script looks for the ui_components.csv and ui_data.impex files in all folders under the current folder, and places the new structure in the resources folder.

  • D:\Workspace\bin\ext-hybris\printcockpit>ant migrate_cockpit_configuration -Df=ui_components.csv -De=impex

    The two flags: f and e shouldn't be used together. In this case, the script looks for all ImpEx files in all folders under the current localization, and places the new structure as default. File name ui_components.csv is omitted, while the file extension is superior.

Script Execution

After typing valid parameters, the script finds all files which meet given conditions. You are asked for each located file whether the file should be used or not. The default value is yes. Using data from the parsed ImpEx configuration file, the proper folders and files names are created, and the data from old XML files is copied to the new localization.

As a result you get the proper folders structure, placed in the current extension. For more information about the naming convention and the folder's structure, see the How to Import Cockpit Configuration.