Customizing web feed integration: Populate feed content using custom business object mediators
To load feed content to custom tables, use the ManagedFile noun with a customized business object mediator. To process logical nouns, customize the business object builder by extending the FeedBusinessObjectBuilder interface.
If you have created your own custom data load mediator for populating HCL Commerce tables, or custom tables, use this procedure to populate these tables using feeds from the Content Management System.
Before you begin
- Review the ManagedFile noun.
- If required, create a custom business object builder.
- Create a business object mediator
- Configure the Data Load utility.
Procedure
- Open the HCL Commerce Developer.
- Locate the WebSphereCommerceServerExtensionsLogic project. Add the files Foundation-DataLoad-FEP.jar and Foundation-DataLoad.jar to the build path of the project. Add any other dependent JAR files to the classpath.
-
If a customized business object builder is required to create and process logical nouns, create
a Java class that extends the com.ibm.commerce.foundation.dataload.businessobjectbuilder.FeedBusinessObjectBuilder
class.
Do not override or execute methods that are used to populate the CMFEEDLOG table:
- init()
- preprocess
- postProcess
- endPropcess
- Create a Java class for the customized business object mediator using the data load framework.
- Package the custom business object builder and business object mediator classes and helper classes in the WebSphereCommerceServerExtensionsLogic project to a JAR file.
- If it does not exist, create the WCDE_installdir\ext\lib directory.
-
Copy the JAR file to the WCDE_installdir\ext\lib
directory.
Custom JAR files are placed in this directory.
-
Prepare the Web-feed-config.xml file. Use the feed URL for managedAsset
type content with the required data.
<config:managedAsset> <config:name>ProductImages</config:name> <config:feedURL><![CDATA[http://9.182.149.211:9080/opencms/opencms/demo_en/today/TestImageFTPFeed.xml]]</config:feedURL> <config:managedDirectory>/unit-test/images</config:managedDirectory> <config:allowedTypes>*.jpg,*.gif</config:allowedTypes> <config:tempFileLocation>C:\temp1</config:tempFileLocation> </config:managedAsset>
-
Run the webFeedLoad utility with the GenerateDataLoadConfigOnly option:
webFeedLoad.bat /fullpath/Web-feed-config.xml -DGenerateDataLoadConfigOnly=true
The workspace\WC\xml\config\dataload\wc-loader-managedFile.xml file is generated. -
Update the generated wc-loader-managedFile.xml file.
- Open the wc-loader-managedFile.xml file.
- Add the customized business object builder and business object mediator.
- Provide the XPath mapping.
- Save and close the file.
If you are not using a customized business object builder, use the FeedBusinessObjectBuilder provided by the content management system. - Run the
webFeedLoad
utility without theGenerateDataLoadConfigOnly
option specified.- ./webFeedLoad.sh ../samples/DataLoad/Content/Web-feed-config.xml -Dwaspath=WC_ear -DlogFileWithTimestamp=true
- webFeedLoad.bat ..\samples\DataLoad\Content\Web-feed-config.xml -DlogFileWithTimestamp=true