illustration of csv -> collection of objects processing
edx Jan 19, 2010 1:23 AMHaving problem with JBossTools regarding smooks editor I prepared the testcase (based on my real one) that illustrates the following steps of processing the CSV documents:
service #1 - smooks action:
CSV reader -> processing CSV files to XML:
<csv-set>
<csv-record>
<csv-record>
<csv-record>
...
<csv-set>
Java Bean -> assigning BatchID to <csv-set> element and assigning record counter to each <csv-record> element
Fremarker -> formatting <csv-record> fragments to the target XML structure (defined by XSD)
- this is done manually, wolud be nice to have editor for such task
JMS router -> routing the formatted <csv-record> fragments to the given destination
service #2 - parser action - submitted messages (XML content) are parsed using JAXB unmarshalling methods that produce messages containg object of the XSD defined type.
The attached archive (tsm.tgz) contains files from the project developed by JBossTools (I used version JT3.1 CR1 and additionally XJC plugin available on java.net site). It contains:
src-> edx/IdGen.java -- the source code of Java Bean used for maintaing BatchID and record counter
src-> edx/actions/MsgLogAction.java - to log the content of processed messages on the selected points of action pipeline
src-> edx/actions/ParseRecord.java - XML parser using JAXB unmarshalling technique
src-> edx/datamodel/*.java - source of java classes produced by XJC (JAXB v2.1) when compiling schema definitions
src-> schema/datarecord.xsd - definition of data objects for JAXB processing
src-> schema/datarecord.xml - illustration of XML document generated from XSD - This was used to produce (here manually, hope JBossTolls will provide in the future automation feature) the relevant freemarker template.
src-> template/record.ftl - the freemarker template to be used by smooks engine when producing output XML fragments
esbcontent-> META-INF/jboss-esb.xml - the ESB deployment descriptor for tsm project
esbcontent-> smooks-config/transform.xml - the configuration file for smooks engine
resources-> dest-service.xml - the configuration of JMS destination queue to which smooks sends the XML fragments (config checked against JBoss Messaging embedded in JBossAS 5.1)
Hope above will be helpfull for applying some of presented illustrations in your projects.
Edward
-
tsm.tgz 6.4 KB