sca-j message
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]
Subject: Re: [sca-j] ISSUE-179: Need type support for @Property when used with SDO
- From: Raymond Feng <rfeng@us.ibm.com>
- To: Simon Nash <oasis@cjnash.com>
- Date: Mon, 14 Sep 2009 11:21:11 -0600
Hi,
I have a few comments/questions here.
1) JAXB is part of JDK since version
1.6. Does sca-j spec mandate JDK 6?
2) It seems to me that you propose to
use JAXB as the canonical databinding. If SDO or other databindings (such
as DOM) is used, then the application developer is responsible for mapping
it to JAXB. If an application developer is required to generate JAXB classes,
why SDO is chosen in the first place?
3) I like Dave's original proposal better
as it allows us to configure/customize the Java types with XML information
in a databinding-agnostic way, when such metadata cannot be acquired by
introspection. The SCA runtime can then use that in the databinding-specific
typing system (such as JAXBContext or SDO HelperContext).
Initially I also thought of adopting
JAXB annotations such as XmlSchemaType, XmlAttribute, XmlElement, XmlAnyElement,
XmlAnyAttribute to supply the XSD type/element/attribute for java types.
But it seemed to be a bit strange that we use one databinding (JAXB) to
describe another databinding.
Thanks,
Raymond
Raymond Feng
Senior Software Engineer, Apache Tuscany PMC Member & Committer
IBM Bay Area Lab, 1001 E Hillsdale Blvd, Suite 400,
Foster City, CA 94404, USA
E-mail: rfeng@us.ibm.com,
Notes: Raymond Feng/Burlingame/IBM, Tel: 650-645-8117,
T/L: 367-8117
Apache Tuscany: http://tuscany.apache.org
Simon Nash <oasis@cjnash.com> wrote on 09/14/2009
07:30:34 AM:
> From:
>
> Simon Nash <oasis@cjnash.com>
>
> To:
>
> David Booz/Poughkeepsie/IBM@IBMUS
>
> Cc:
>
> sca-j@lists.oasis-open.org
>
> Date:
>
> 09/14/2009 07:31 AM
>
> Subject:
>
> Re: [sca-j] ISSUE-179: Need type support for @Property when used with
SDO
>
> Dave,
> Responses inline below.
>
> Simon
>
> David Booz wrote:
> > Hi Simon,
> >
> > Thanks for the research. Don't you think it would be quite odd
if the
> > spec required the use of JAXB emitters (this is what I find the
most
> > troubling) in order to use SDO with a specific schema type?
> >
> JAXB is built built into the JDK, so I'm not sure why it is burdensone
> to run the JAXB emitters. The emitted class could be placed
in a
> separate Java package that clearly identifies it as an emitted
> JAXB artifact and doesn't interfere with any classes in Java packages
> used by the implementation.
>
> >
My
argument
> > remains the same. We need a way to simplify the use of SDO as
a
> > databinding technology, enabling the developers to work with
the minimal
> > number of building blocks. While I agree that the @XmlJavaTypeAdapter
> > seems to "work", it doesn't meet the requirement as
something that would
> > be intuitive to use because it introduces extra concepts that
the
> > developer doesn't really need. The simple extension that I've
proposed
> > provides an easily understandable integration point because the
> > developer only has to deal with the SDO API and XML schema.
> >
> Support for @XmlJavaTypeAdapter is already mandated in SCA-J, and
JAXB
> is a standard part of the JDK. It seems very strange to me to
invent
> a new facility that duplicates existing capabilities that are included
> in SCA-J and the JDK. IMO this is more confusing for developers
than
> explaining how they can use existing capabilities to do what they
need.
>
> > The @XmlAnyElement seems like a reasonable approach for the mapping
of
> > SDO to <any/>, so I can probably live with it for those
use cases that
> > require <any/>. Are there any other JAXB annotations that
would have to
> > appear in the Java class in order to make this work?
> >
> No other annotations are needed.
>
> Simon
>
> > Dave Booz
> > STSM, BPM and SCA Architecture
> > Co-Chair OASIS SCA-Policy TC and SCA-J TC
> > "Distributed objects first, then world hunger"
> > Poughkeepsie, NY (845)-435-6093 or 8-295-6093
> > e-mail:booz@us.ibm.com
> >
> > Inactive hide details for Simon Nash ---09/05/2009 07:46:03 AM---On
> > Friday's call I took an action to see whether JAXB annotatiSimon
Nash
> > ---09/05/2009 07:46:03 AM---On Friday's call I took an action
to see
> > whether JAXB annotations can be used to override the defaul
> >
> >
> > From:
> > Simon Nash <oasis@cjnash.com>
> >
> > To:
> > sca-j@lists.oasis-open.org
> >
> > Date:
> > 09/05/2009 07:46 AM
> >
> > Subject:
> > Re: [sca-j] ISSUE-179: Need type support for @Property when used
with SDO
> >
> > ------------------------------------------------------------------------
> >
> >
> >
> > On Friday's call I took an action to see whether JAXB annotations
can be
> > used to override the default JAXB mapping from a Java property
type
> > to a schema type.
> >
> > The answer is that this can be done with the @XmlJavaTypeAdapter
annotation.
> > If there is a property whose Java type is the interface DataObject
and it
> > needs to be mapped to a specific schema type such as "address",
the
> > following
> > steps are needed:
> > 1. Create an xsd file for the "address" schema
type.
> > 2. Generate a Java class Address from this xsd file using
JAXB.
> > 3. Create a JAXB adapter class to specify the property
mapping, for
> > example:
> > public class AddressAdapter extends XmlAdapter<Address,
DataObject> {
> > public DataObject unmarshal(Address
value) {
> > // If the SCA runtime will
use the JAXB unmarshaller to convert
> > // the property value to a
Java object, this method needs to
> > // contain code to create an
instance of DataObject from an Address
> > // object passed in by the
JAXB unmarshaller. If the property
> > // conversion will be done
in some other way (e.g., by SDO), this
> > // method can just return null.
> > }
> > public Address marshal(DataObject
value) {
> > return null; // SCA properties
are never converted from Java to XML
> > }
> > }
> > 4. Annotate the property whose Java type is DataObject
with the
> > annotation @XmlJavaTypeAdapter(AddressAdapter.class)
> > A separate adapter class is required for every schema type that
is a
> > possible
> > mapping target for the property.
> >
> > If the property needs to be mapped to a specific schema element
instead of
> > a schema type, the steps are the same except that an "address"
schema
> > element
> > is used in step 1, and an additional annotation @XmlElement(name="address")
> > is used on the property in step 4.
> >
> > If the property needs to be mapped to a schema <any> element,
steps 1, 2 and
> > 3 are not needed. In step 4, the annotation @XmlAnyElement
is used on the
> > property instead of @XmlJavaTypeAdapter.
> >
> > I have verified all of the above with some simple test code.
> >
> > Simon
> >
> > David Booz wrote:
> > > http://www.osoa.org/jira/browse/JAVA-179
> > >
> > > Dave Booz
> > > STSM, BPM and SCA Architecture
> > > Co-Chair OASIS SCA-Policy TC and SCA-J TC
> > > "Distributed objects first, then world hunger"
> > > Poughkeepsie, NY (845)-435-6093 or 8-295-6093
> > > e-mail:booz@us.ibm.com
> > >
> > > Inactive hide details for David Booz---08/24/2009
04:16:58 PM---TARGET:
> > > Java CAA CD03 and Java POJO CD01 DESCRIPTION:David
Booz---08/24/2009
> > > 04:16:58 PM---TARGET: Java CAA CD03 and Java POJO
CD01 DESCRIPTION:
> > >
> > >
> > > From:
> > > David Booz/Poughkeepsie/IBM@IBMUS
> > >
> > > To:
> > > sca-j@lists.oasis-open.org
> > >
> > > Date:
> > > 08/24/2009 04:16 PM
> > >
> > > Subject:
> > > [sca-j] NEW ISSUE: Need type support for @Property
when used with SDO
> > >
> > > ------------------------------------------------------------------------
> > >
> > >
> > >
> > > TARGET: Java CAA CD03 and Java POJO CD01
> > >
> > > DESCRIPTION:
> > > SDO DataObject can be mapped to any XML schema type,
and therefore
> > > literally <any> as well. There is no way to
specify the concrete XML
> > > type of a Java property who's Java type is SDO DataObject.
> > >
> > > PROPOSAL:
> > > Will be attached to JIRA once the issue is logged.
> > > Basically, the proposal will introduce two new attributes
on @Property,
> > > xmlType (for specifying the XML schema type) and xmlElement
(for
> > > specifying an XML global element that denotes the
type). The new
> > > attributes are mutually exclusive.
> > >
> > >
> > > Dave Booz
> > > STSM, BPM and SCA Architecture
> > > Co-Chair OASIS SCA-Policy TC and SCA-J TC
> > > "Distributed objects first, then world hunger"
> > > Poughkeepsie, NY (845)-435-6093 or 8-295-6093
> > > e-mail:booz@us.ibm.com
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this mail list, you must leave the OASIS
TC that
> > generates this mail. Follow this link to all your TCs in
OASIS at:
> > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this mail list, you must leave the OASIS TC that
> generates this mail. Follow this link to all your TCs in OASIS
at:
> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
>
S/MIME Cryptographic Signature
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]