You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Scott Kurz <sc...@gmail.com> on 2007/10/04 15:13:42 UTC

concerns w/ Tuscany databinding framework and Java-centric databindings

I wonder what we think about the Tuscany databinding framework and how it
could be used with Java-centric databindings (as opposed to say, XML-based
databindings).

Say I'm writing a binding which will use Java serialization to send/receive
data over the binding transport.

One approach would be to use the java.lang.Object databinding for my
binding's interface contract.

I've found that if I want to do this, it seems to be a lot easier if I
introduce a few very basic transformers:
   Simple2Object, Object2Simple, DataObject2Object,
with each doing no more than returning the input source object passed to
transform().

Otherwise I end up in transformer chains like:
  SimpleJavaType2Node, DOMNode2JavaBeanTransformer
which is unnecessary to simply pass along a Java primitive type.

I'm just wondering, though, how Raymond and others who've given the
databinding framework some thought would react to introducing those
transforms into the web of transformers.
Every entry "pollutes" the web a bit, of course.

An alternative approach is to do everything possible to avoid the Tuscany
databinding framework and to make sure a DataTransformationInterceptor is
not set up on the wire to/from the binding.
I wonder if that is the "preferred" approach Raymond had in mind??     Of
course the downside of this is that I lose the ability for my binding to
handle, say, a DOM Node, which Tuscany has a transform to Object for.

I realize that there's some other context in my situation I'm not
mentioning.   Namely, I'm partly doing things the way I am to workaround
JIRAS 1679,1680.

But still, maybe my question is worth addressing on its own.

Thanks,
Scott

Re: concerns w/ Tuscany databinding framework and Java-centric databindings

Posted by Raymond Feng <en...@gmail.com>.
Hi,

Please see my comments inline.

Thanks,
Raymond

----- Original Message ----- 
From: "Scott Kurz" <sc...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Thursday, October 04, 2007 6:13 AM
Subject: concerns w/ Tuscany databinding framework and Java-centric 
databindings


>I wonder what we think about the Tuscany databinding framework and how it
> could be used with Java-centric databindings (as opposed to say, XML-based
> databindings).
>
> Say I'm writing a binding which will use Java serialization to 
> send/receive
> data over the binding transport.
>

Let's define a new databinding such as "java:serialized" to capture this 
format.

> One approach would be to use the java.lang.Object databinding for my
> binding's interface contract.
>

We should rename the java beans data binding from "java.lang.Object" to 
"java:complexType" to avoid confusions.

> I've found that if I want to do this, it seems to be a lot easier if I
> introduce a few very basic transformers:
>   Simple2Object, Object2Simple, DataObject2Object,
> with each doing no more than returning the input source object passed to
> transform().

Do you try to use these transformers to convert the simple types to the 
serialized java format?
>
> Otherwise I end up in transformer chains like:
>  SimpleJavaType2Node, DOMNode2JavaBeanTransformer
> which is unnecessary to simply pass along a Java primitive type.
>

In your case, we can add a transformer from java:simpleType to 
java:serialized to support the pass through. For complex types, 
java:complexType --> java:serialized will do.

> I'm just wondering, though, how Raymond and others who've given the
> databinding framework some thought would react to introducing those
> transforms into the web of transformers.
> Every entry "pollutes" the web a bit, of course.
>
Some transformers can only be used as either the first or last edge on the 
path. I use a very heavy weight to avoid a transformer to be used as 
intermediaries. We can even add a flag to a transformer to tell if it can 
serve as an intermediary.

> An alternative approach is to do everything possible to avoid the Tuscany
> databinding framework and to make sure a DataTransformationInterceptor is
> not set up on the wire to/from the binding.
> I wonder if that is the "preferred" approach Raymond had in mind??     Of
> course the downside of this is that I lose the ability for my binding to
> handle, say, a DOM Node, which Tuscany has a transform to Object for.
>

A good balance is needed. The databinding framework is used to help the 
"well-known" types of transformation that can be handled as system code. For 
a binding, it expresses its expectation of data format and the framework 
helps to meet such requirement.

> I realize that there's some other context in my situation I'm not
> mentioning.   Namely, I'm partly doing things the way I am to workaround
> JIRAS 1679,1680.
>
> But still, maybe my question is worth addressing on its own.
>
> Thanks,
> Scott
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org