4 Replies Latest reply on Feb 12, 2010 5:17 AM by Tom Fennelly

    How to reference objects stored in Smooks ExecutionContext?

    Edward Pilipczuk Newbie


      I think I have a serious problem to solve.

      The huge data files (structured data records, lets assume all records have the same layout, e.g., CSV) are to be processed in a way they are  splitted and converted to small XML chunks. I have applied smooks engine with freemarker for this task and it works fine except that the processing pipeline do not provide traceability of final XML fragments back to datafile from which they are originated.

      I have created FileFetchExecute class that is implementation of ScheduledEventMessageComposer interface.

      This class prepares URI to the file and stores it in Header->Call->RelatesTo field of the created ESB message.

      Then the custom Action class invokes smooks engine. The reasons of using custom Action class are two:

      1. MyAction prepares FileReader for the source datafile and that is impossible in out-of-the-box SmooksAction (rosetta complains about serialization).

      2. MyActions stores the URI of the source file into Smooks ExecutionContext under some arbitrary name in order to be available by smooks resources defined and configured in smooks-config.xml.


      And here is the final question.

      How to reference objects from ExecutionContext from JavaBeans instantiated by Smooks and/or from Freemarker template processing?