Creating custom column handlers
Create a custom column handler so that the Data Load utility can resolve data
and load the data into database columns. Create a custom column handler to resolve the data that
cannot be mapped to a column value through the data load
configuration.For example, if you input data to populate the password
column in the database with a clear text password. If the password column expects an encrypted
value, create a custom column handler to encrypt the clear text password. The handled can then
return an encrypted password from the
resolveColumnValue()
method.Before you begin
Ensure that you understand the following information:
- The API for the com.ibm.commerce.foundation.dataload.config.AbstractColumnHandler abstract class.
- The API for the com.ibm.commerce.foundation.dataload.config.ColumnHandler interface.
About this task
Procedure
- Open WebSphere Commerce Developer.
- Switch to the Java EE perspective.
- In the Enterprise Explorer view, double-click WebSphereCommerceServerExtensionsLogic to open this project.
- In the WebSphereCommerceServerExtensionsLogic project, create a new custom column handler class that extends from the AbstractColumnHandler class. Implement the resolveColumnValue() abstract method within the custom column handler class.
- Optional: Override the init() or close() methods to achieve the functionality of your handler.
-
Open your sample business object configuration file that uses com.ibm.commerce.foundation.dataload.businessobjectbuilder.TableObjectBuilder.
For an example of a business object configuration file, see the wc-loader-member-group-condition.xml sample file in the WCDE_installdir\samples\DataLoad\Member directory.
- If the <_config:ColumnHandler> element does not exist in this file, add this element and specify the class name of your customized column handler. If the <_config:ColumnHandler> element exists in your file, update the className attribute within this element with the class name of your customized column handler.
- Save and close the file.
- Repeat step 6 for each of your business object configuration files.
What to do next
- Package your custom column handler class in the WebSphereCommerceServerExtensionsLogic project to a JAR file.
- Create the WC_installdir\ext\lib directory if it does not exist, and copy the JAR file to the WC_installdir\ext\lib directory. You must place your custom JAR files in this directory.
- Copy all of the custom data load configuration files from WCDE_installdir\samples\DataLoad (WebSphere Commerce development environment) to WC_installdir\samples\DataLoad (WebSphere Commerce server environment).
- Run the Data Load utility to load data with your custom data load configuration files to the WebSphere Commerce database.