tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Sebastien Delfino <jsdelf...@apache.org>
Subject Re: Question on ModelObject for binding extension
Date Tue, 10 Apr 2007 20:46:28 GMT
Pamela Fong wrote:
> Hi,
>
> I read the article "Extending Tuscany by contributing a new 
> implementation /
> binding type" by Raymond and Jeremy. Got a question about the 
> definition of
> ModelObject. The example in the article is a very simple java bean-like
> object. This is fine if all we have to deal with is some simple 
> attributes
> in the extension. If the binding requires complex SCDL model extension,
> defining the ModelObject by hand may not be the best choice (let's say 
> one
> could have mulitple layers of nested elements and arrays etc.). One 
> obvious
> alternative would be to generate some model code based on the extension
> xsd using EMF. However, since the binding's xsd extends from 
> sca-core.xsd,
> generating model code would require the core model, which doesn't 
> exist in
> Tuscany. What would be the recommended mechanism to define the 
> ModelObject
> in this case?
>
> -pam
>

Hi,

ModelObject does not exist anymore in the latest assembly model in trunk 
(now under java/sca/modules/assembly). The assembly model is now 
represented by a set of interfaces, so you have the flexibility to 
implement your model classes however you want, without having to extend 
a ModelObject class.

You can choose to use EMF or another suitable XML databinding technology 
to implement your model classes or, probably simpler, just create plain 
Java classes that implement the model interfaces. The only requirement 
for a binding model class is to implement the o.a.t.assembly.Binding 
interface. Then, if you choose the "plain java class" option, to read 
the model from XML use StAX as we've done for the other bindings (see 
java/sca/modules/binding-ws-xml for an example), it is actually pretty 
easy thanks to StAX.

Hope this helps.

-- 
Jean-Sebastien


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


Mime
View raw message