You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2006/06/21 01:07:39 UTC
[PROTOTYPE] Transformation across multiple databindings
Hi,
I created a prototype to demonstrate how we can support multiple databindings and transform data accross them. You can get the code from: http://wiki.apache.org/ws/Tuscany/TuscanyJava/DataMediation
The transformation capability is modeled as Transformer which can transform the data from source type to result type. The transformers are registered and selected using the following algorithm.
1) The data transformation capabilities for various databindings can be nicely modeled as a weighted, directed graph with the following rules. (Illustrated in the attached diagram).
* Each databinding type is mapped to a vertex.
* If databinding A can be transformed to databinding B, then an edge will be added from vertex A to vertex B.
* The weight of the edge is the cost of the transformation from the source to the sink.
2) In the data mediator/interceptor on the wire, if we find out that the data needs to be transformed from databinding A to databinding E. Then we can apply Dijkstra's Shortest Path Algorithm to the graph and figure the most performed path. It can be A-->E, or A-->C-->E depending on the weights. If no path can be found, then the data cannot be mediated.
The initial drop contains some basic transformer implementations for the following databindings:
1) XML String
2) DOM Node
3) StAX XMLStreamReader
4) SDO DataObject/XMLDocument
5) XMLBeans XmlObject
6) JAXB Object
It also comes a test case which shows the following transformation via multiple hops:
1) XMLBeans --> SDO
2) SDO --> DOM
3) SDO --> JAXB
I also find out there are some interesting issues:
1) In some cases, the target side prefer to provide a callback to receive data pushed from the source side. The SAX ContentHandler is a good example.
2) How to supply context data for the transformations, for example, JAXB requires either the java package names or classes?
3) How do we pipe the data from one output to another input, for example, OutputStream connects to InputStream?
4) How do we integrate the framework with the Tuscany invocation chain (message handler and interceptor)? I guess Ant has started some work here.
Thanks, Raymond