Hi Anjana,
On Mon, Mar 12, 2012 at 11:21 AM, Anjana Fernando <[email protected]> wrote: > Hi Lakmali, > > Great job in getting all the Smooks features work with the mediator! .. > Please integrate all these feature to the trunk, and update the samples to > demonstrate the new functionalities. A small comment on the JPA > integration, use the attribute name "persistence-unit" to keep the naming > scheme consistent. > > Thanks for the feedback and +1 for changing the attribute name. Will update the trunk with the changes and sample services. thanks, Lakmali > Cheers, > Anjana. > > On Mon, Mar 12, 2012 at 11:06 AM, Lakmali Baminiwatta <[email protected]>wrote: > >> Forwarding to [email protected]. >> >> >> ---------- Forwarded message ---------- >> From: Lakmali Baminiwatta <[email protected]> >> Date: Mon, Mar 12, 2012 at 10:35 AM >> Subject: ESB Smooks Mediator Improvements Summary >> To: [email protected] >> >> >> Hi all, >> >> I have been working on Improving ESB Smooks Mediator to support Main >> Smooks Features as stated in [1]. Most of the features were able to be >> executed on current Smooks mediator without any modifications. So for those >> features I wrote some sample services and tested them. Here are the list of >> those features. >> >> 1. Transformation - XML, CSV, EDI to XML >> 2. Java Binding - Bind input message into Java object models and use them >> in templating, database routing, etc. >> 3. Message Enrichment - routing input message from supported datasource >> to a database >> 4. Templating - Freemarker Templating and XSL Templating can be applied >> to input messages to do the followings >> - Fragment based transformation >> - Generate Split message Fragments >> 5. Scripting - Groovy scripting can be applied to messages to process and >> do the necessary changes to the message elements >> 6. Combine - Perform ETL operatons by, >> - Extracting data from multiple sources (CSV, EDI, XML) >> - Transforming to required format (Readers[XML, CSV, EDI Readers], >> Templating, Scripting) >> - Routing to the endpoints (Database, Files, ESB) >> >> Further for performing following three features I had to do improvements >> to the Smooks mediator. >> >> 7. Huge Message Processing >> >> Processing large messages requires streaming from the MessageContext to >> the mediator which is not a feature of the current Smooks mediator. >> Therefore I did the necessary improvements to support streaming inside the >> mediator. >> >> Input Type :- Text >> Axiom API supports streaming of text nodes that are children of a >> given element. >> Input Type :- XML >> Since Axiom API does not support streaming XML events to an >> InputStream, I implemented a way to stream xml events from the OMElement. >> >> I have tested the improved Smooks Mediator for large input messages of >> XML & Text. ESB reads the input file through VFS transport. Then Smook >> mediator split the message, apply freemarker template, and route to file >> locations. So the large message is split out, and each split part is >> written into separate files. Also the message can be routed to databases >> where each split message is a single record. >> >> >> 8. Java Resulting >> >> Smooks has the ability to return the content of the bean context (where >> every java bean created is registered under beanId) after the filtering >> process. This result is an org.milyn.delivery.java.JavaResult object whose >> beans can be retrieved by beanIds. I did the necessary changes to the >> Smooks mediator to bind the Smooks Java Result as a property, to the >> MessageContext. Now the Smooks mediator has new output type 'Java'. With >> this improvement mediators followed by Smooks Mediator can retrieve the >> Java object from the MessageContext. I tested this scenario through a >> custom mediator which get the property set by Smooks Mediator and retrieve >> the bean by beanId. >> >> <smooks config-key="smooks-key"> >> <input type="xml"/> >> <output type="java" property="order"/> >> </smooks> >> >> So followed mediators can retireve the bean values as, >> >> JavaResult result = (JavaResult)synCtx.getProperty("order"); >> Order order = (Order)result.getBean("order"); >> >> 9. Entity Persistent Framework support - JPA >> >> Smooks support using several Entity Persistence Providers such as JPA, >> Hibernate. Executing JPA with Smooks require initializing an entity manager >> for defined persistence unit (in Persistence.xml) and stating a transaction >> before executing smooks filtering. When improving Smooks mediator to >> perform those an issue encountered in finding the persistence provider >> (Hibernate-Entity manager in this case) and persistence.xml even though >> necessary jars were placed inside ESB repository/components/lib. As a >> workaround I found the solution as to place the Persistence Provider jar >> and the jar containing Entity classes with the Persistence.xml to be placed >> inside outer lib folder (They need to be inside repository/components/lib >> as well). >> >> Now smooks mediator can be configured with persistence-unit attribute >> which represent the persistence unit name defined inside Persistence.xml. >> >> <smooks config-key="smooks-key" persistence_unit="db"> >> <input type="xml" /> >> <output type="xml"/> >> </smooks> >> >> So I have completed the implementation of improvements to Smooks Mediator >> for supporting the main features provided by Smooks. Any suggestions or >> comments are really appreciated. >> >> [1] >> http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide >> <http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide> >> >> Thanks, >> Lakmali >> >> -- >> Lakmali Baminiwatta* >> * >> Software Engineer >> WSO2, Inc.: http://wso2.com >> lean.enterprise.middleware >> >> * >> * >> >> >> >> >> -- >> Lakmali Baminiwatta* >> * >> Software Engineer >> WSO2, Inc.: http://wso2.com >> lean.enterprise.middleware >> mobile: +94 71 2335936 >> * >> * >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > *Anjana Fernando* > Senior Software Engineer > WSO2 Inc. | http://wso2.com > lean . enterprise . middleware > -- Lakmali Baminiwatta* * Software Engineer WSO2, Inc.: http://wso2.com lean.enterprise.middleware mobile: +94 71 2335936 * *
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
