You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jeremy Boynes <jb...@apache.org> on 2006/04/11 00:26:44 UTC
How should application components access SDO Helpers?
The SDO spec provides the Helper.INSTANCE mechanism that we all know and
love ;-)
I'd like to explore alternatives for how a SCA component can perform SDO
operations without needing to use these static variables.
One option is that the component can declare an @Property with the
requested SDO helper e.g.
@Property
public DataFactory sdoDataFactory;
and that we enhance container.java to automatically recognise these
property type and have it inject a reference to the appropriate SDO helper.
An alternative is that we handle this with a custom PropertyFactory
requiring the user to specify the factory="..." attribute when
configuring the property. The SCDL would be something like:
<component name="...">
<properties>
<v:sdoDataFactory factory="o.a.t...SDOHelperFactory"/>
Or, we can add a new annotation that can be used to denote where a
helper should be injected e.g.
@o.a.t...SDOHelper
public DataFactory sdoDataFactory;
and presumably the equivalent extension to the componentType sidefile.
My preference is for the last option as it does not tie this behaviour
to just container.java and doesn't require any special setup by the
assembler.
Any other thoughts or preferences?
--
Jeremy
Re: How should application components access SDO Helpers?
Posted by Frank Budinsky <fr...@ca.ibm.com>.
Jean-Sebastien Delfino <js...@apache.org> wrote on 04/13/2006 11:14:55
PM:
> All of these would require a Java 5 dependent SDO subproject. People
> running on 1.4 would just not use the resulting JAR. Any opinions from
> the people working on SDO?
This sounds like a good approach. A subproject that provides new Java 5
dependant features. We can also work with the SDO spec group to try to get
these new features into a future (SDO 3?) version of the spec.
Frank.
Re: How should application components access SDO Helpers?
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Paul Golick wrote:
> Jean-Sebastien Delfino wrote in reply to Jim Marino:
>
>> I prefer the last one as well. I'm thinking that the annotation itself
>> should be part of the SDO project, how about
>> @org.apache.tuscany.sdo.SDOHelper?
>>
>
> How can annotation definitions be added in the SDO project without making
> SDO dependent on Java 5?
> The SDO portion of the source tree specifies Java 1.4 as its target
> version.
>
> Regards,
> Paul Golick
>
>
I was thinking that we could have a subproject/module under the SDO
project with Java 5 extensions.
We've discussed the following so far:
- @org.apache.tuscany.sdo.SDOHelper
- @ annotations allowing an application developer to define SDOs using
Java interfaces and annotate them to specify the XSD metadata (we've not
really discussed the details, but I guess we'd need annotations to
specify the namespace, XML name, whether a property translates to an XSD
attribute or element, etc.)
... and this is going beyond the SDO spec and has not been discussed
yet, but I was also thinking that it would be nice to add support for
Java 5 generics at some point (<element ... type="Customer"
maxOccurs="unbounded"/> would translate to a List<Customer> instead of
just List).
All of these would require a Java 5 dependent SDO subproject. People
running on 1.4 would just not use the resulting JAR. Any opinions from
the people working on SDO?
--
Jean-Sebastien
Re: How should application components access SDO Helpers?
Posted by Paul Golick <go...@us.ibm.com>.
Jean-Sebastien Delfino wrote in reply to Jim Marino:
>I prefer the last one as well. I'm thinking that the annotation itself
>should be part of the SDO project, how about
>@org.apache.tuscany.sdo.SDOHelper?
How can annotation definitions be added in the SDO project without making
SDO dependent on Java 5?
The SDO portion of the source tree specifies Java 1.4 as its target
version.
Regards,
Paul Golick
Re: How should application components access SDO Helpers?
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Jim Marino wrote:
> I generally tend to prefer the last option as well. The second is kind
> of bad in my opinion as it ties an application to the internal
> implementation of the runtime. The first requires the runtime to have
> knowledge for every type. As an alternative, what if we supported
> @Resource from Java commons annotations for this type of stuff?
>
> Jim
>
>
> On Apr 10, 2006, at 3:26 PM, Jeremy Boynes wrote:
>
>> The SDO spec provides the Helper.INSTANCE mechanism that we all know and
>> love ;-)
>>
>> I'd like to explore alternatives for how a SCA component can perform SDO
>> operations without needing to use these static variables.
>>
>> One option is that the component can declare an @Property with the
>> requested SDO helper e.g.
>>
>> @Property
>> public DataFactory sdoDataFactory;
>>
>> and that we enhance container.java to automatically recognise these
>> property type and have it inject a reference to the appropriate SDO
>> helper.
>>
>> An alternative is that we handle this with a custom PropertyFactory
>> requiring the user to specify the factory="..." attribute when
>> configuring the property. The SCDL would be something like:
>>
>> <component name="...">
>> <properties>
>> <v:sdoDataFactory factory="o.a.t...SDOHelperFactory"/>
>>
>> Or, we can add a new annotation that can be used to denote where a
>> helper should be injected e.g.
>>
>> @o.a.t...SDOHelper
>> public DataFactory sdoDataFactory;
>>
>> and presumably the equivalent extension to the componentType sidefile.
>>
>>
>> My preference is for the last option as it does not tie this behaviour
>> to just container.java and doesn't require any special setup by the
>> assembler.
>>
>> Any other thoughts or preferences?
>> --
>> Jeremy
>>
>
>
I prefer the last one as well. I'm thinking that the annotation itself
should be part of the SDO project, how about
@org.apache.tuscany.sdo.SDOHelper?
--
Jean-Sebastien
Re: How should application components access SDO Helpers?
Posted by Jim Marino <jm...@myromatours.com>.
I generally tend to prefer the last option as well. The second is
kind of bad in my opinion as it ties an application to the internal
implementation of the runtime. The first requires the runtime to
have knowledge for every type. As an alternative, what if we
supported @Resource from Java commons annotations for this type of
stuff?
Jim
On Apr 10, 2006, at 3:26 PM, Jeremy Boynes wrote:
> The SDO spec provides the Helper.INSTANCE mechanism that we all
> know and
> love ;-)
>
> I'd like to explore alternatives for how a SCA component can
> perform SDO
> operations without needing to use these static variables.
>
> One option is that the component can declare an @Property with the
> requested SDO helper e.g.
>
> @Property
> public DataFactory sdoDataFactory;
>
> and that we enhance container.java to automatically recognise these
> property type and have it inject a reference to the appropriate SDO
> helper.
>
> An alternative is that we handle this with a custom PropertyFactory
> requiring the user to specify the factory="..." attribute when
> configuring the property. The SCDL would be something like:
>
> <component name="...">
> <properties>
> <v:sdoDataFactory factory="o.a.t...SDOHelperFactory"/>
>
> Or, we can add a new annotation that can be used to denote where a
> helper should be injected e.g.
>
> @o.a.t...SDOHelper
> public DataFactory sdoDataFactory;
>
> and presumably the equivalent extension to the componentType sidefile.
>
>
> My preference is for the last option as it does not tie this behaviour
> to just container.java and doesn't require any special setup by the
> assembler.
>
> Any other thoughts or preferences?
> --
> Jeremy
>