[ 
https://issues.apache.org/activemq/browse/CAMEL-2761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59597#action_59597
 ] 

Christian Mueller commented on CAMEL-2761:
------------------------------------------

My proposal, which I discuss with Tom Fennelly:

Here are my first thoughts:

1) How could Camel improve Smooks? What do you have in mind?

2)  How could Smooks improve Camel? Here are my ideas:

2a) Java Binding:

DataFormat smooksUnmarshal = new 
SmooksDataFormat("smooks-unmarshal-config.xml");
from("file://inbox")
.unmarshal(smooksUnmarshal) // source is a StreamSource, result is a JavaResult
.to("bean:orderEntry");

We could do this for CSV, EDI, XML, fixed length, YAML and JSON, could we?

But what is with marshaling? My understanding is Smooks "only" supports 
marshaling to XML. It is right? Do you plan also to support other formats like 
CSV, fixed length, ...? Or "only" with templating?

We could also provide marshaling functionality for this:

DataFormat smooksMarshal = new SmooksDataFormat("smooks-marshal-config.xml");
from("bean:orderEntry")
.unmarshal(smooksMarshal) // source is a JavaSource, result is a StreamResult
.to("file://outbox");

Make this sense?
This is also the solution for the current camel-smooks component: 
http://camel.apache.org/smooks.html

Please have a look on the attached SmooksDataFormat.java


2b) Transformation:
Could we express transformation as a sequence of unmarshal and marshal?
If not, I would propose a solution like the camel-xslt component: 
http://camel.apache.org/xslt.html

Than we could write a route like this:
from("file://inbox")
.to("smooks://path/to/smooks-config.xml") // source is a StreamSource, result 
is a StreamResult
.to("file://outbox");

or

Than we could write a route like this:
from("bean:orderEntry")
.to("smooks://path/to/smooks-config.xml") // source is a JavaSource, result is 
a JavaResult
.to("bean:orderStore");

With this solution it's also possible to handle Java Binding (2a)). But we have 
to know, what is the source we will receive (Java, Stream, ...) and what is the 
result (Java, Stream, ...). It is possible to "ask" the Smooks instance for 
that so that we know, which kind of source and result we have to provide in the 
filterSource method?

What do you think?

Regards,
Christian

> Improve camel-smooks to support all features smooks provide
> -----------------------------------------------------------
>
>                 Key: CAMEL-2761
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2761
>             Project: Apache Camel
>          Issue Type: New Feature
>    Affects Versions: 2.4.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Christian Mueller
>             Fix For: 2.4.0
>
>
> Provide a better integration between Camel and Smooks and support all 
> features in Camel which Smooks provide. A good starting point is:
> http://blog.smooks.org/2010/02/22/apache-camel-smooks/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to