OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-j message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sca-j] Why is @Property.required attribute MUST be true forconstructor parameter?


I will raise an issue to add a defaultValue attribute to the @Property
annotation.

++Vamsi
Apache Tuscany Committer  http://tuscany.apache.org
Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org


                                                                           
             Simon Nash                                                    
             <oasis@cjnash.com                                             
             >                                                          To 
                                       sca-j@lists.oasis-open.org          
             27/02/2009 20:05                                           cc 
                                                                           
                                                                   Subject 
                                       Re: [sca-j] Why is                  
                                       @Property.required attribute MUST   
                                       be true for constructor parameter?  
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Mike Edwards wrote:
>
> Vamsi,
>
> I don't feel strongly about the case that you describe.
>
> If a using <component/> cares about the value of a property, then it
> will set the value in the configuration
> of that property.  The component can always get the value it wants.
>
> I certainly don't think that componentType side files are a good
> solution to this question - a huge hammer
> to crack a very small nut.
>
> The idea of a defaultValue attribute to the @Property annotation is an
> elegant solution to the problem of
> not being able to introspect an initializer.  However, I don't think the
> function implied is significant enough
> to be worth bothering with.
>
I think this is a good suggestion and I think it is worth adding
to the spec.  Thre are many cases where it would be useful for the
implementation to provide a default value.

   Simon

>
> Yours,  Mike.
>
> Strategist - Emerging Technologies, SCA & SDO.
> Co Chair OASIS SCA Assembly TC.
> IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain.
> Phone & FAX: +44-1962-818014    Mobile: +44-7802-467431
> Email:  mike_edwards@uk.ibm.com
>
>
> From:     C Vamsi <vamsic007@in.ibm.com>
> To:       Mike Edwards/UK/IBM@IBMGB
> Cc:       sca-j@lists.oasis-open.org
> Date:     25/02/2009 10:45
> Subject:  Re: [sca-j] Why is @Property.required attribute MUST be true
> for constructor parameter?
>
>
> ------------------------------------------------------------------------
>
>
>
> Mike,
>
> The one case that will not be supported by doing away with componentType
> side files for POJOs is the default value for a property since the field
> initializer value can not be obtained through introspection (at least in
> Java 5). Does this call for introducing a new attribute (say,
> @defaultValue) in the @Property annotation?
>
> Another case, but not of immediate concern, would the componentType file
> support for implementation types defined in Java EE spec.
>
> ++Vamsi
> Apache Tuscany Committer  http://tuscany.apache.org
> <http://tuscany.apache.org/>
> Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org
> <http://geronimo.apache.org/>
>
>
>
>             Mike Edwards
>             <mike_edwards@uk.
>             ibm.com>                                                   To
>                                       sca-j@lists.oasis-open.org
>             25/02/2009 15:47                                           cc
>
>                                                                   Subject
>                                       Re: [sca-j] Why is
>                                       @Property.required attribute MUST
>                                       be true for constructor parameter?
>
>
>
>
>
>
>
>
>
>
> Vamsi,
>
> You make a good point in reminding me that the Java TC has not voted
> through a resolution to remove the use
> of componentType side files for Java POJOs.  I have now raised a new
issue
> to do this - which will remove
> Section 10 entirely.
>
> I note that the Liaison committee posted a recommendation that
> implementation types either use pure introspection
> OR purely use a side file and never try to combine the information from
two
> sources.  Java POJOs can have all
> their component type metadata derived via introspection - as a result
side
> files are not useful and add complexity.
>
>
> Yours,  Mike.
>
> Strategist - Emerging Technologies, SCA & SDO.
> Co Chair OASIS SCA Assembly TC.
> IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain.
> Phone & FAX: +44-1962-818014    Mobile: +44-7802-467431
> Email:  mike_edwards@uk.ibm.com
>
>
>
> From:     C Vamsi <vamsic007@in.ibm.com>
>
> To:       Mike Edwards/UK/IBM@IBMGB
>
> Cc:       sca-j@lists.oasis-open.org
>
> Date:     24/02/2009 10:15
>
> Subject:  Re: [sca-j] Why is @Property.required attribute MUST be true
>           for constructor parameter?
>
>
>
>
>
>
>
> Comments inline in <vamsi> tags.
>
> ++Vamsi
> Apache Tuscany Committer  http://tuscany.apache.org
> <http://tuscany.apache.org/>
> Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org
> <http://geronimo.apache.org/>
>
>
>
>             Mike Edwards
>             <mike_edwards@uk.
>             ibm.com>                                                   To
>                                       sca-j@lists.oasis-open.org
>             24/02/2009 15:22                                           cc
>
>                                                                   Subject
>                                       Re: [sca-j] Why is
>                                       @Property.required attribute MUST
>                                       be true for constructor parameter?
>
>
>
>
>
>
>
>
>
>
> Folks,
>
> When using constructor parameters for injection, there are a couple of
> considerations to bear in mind:
>
> 1) Each constructor parameter MUST be annotated with either @Reference or
> with @Property, depending
> on the type of the parameter.  This is required in order that each
> parameter has a NAME which then appears
> in the componentType - without this, it is impossible to get a name for
the
> constructor parameter (none is
> available via introspection)
>
> 2) Clearly, each constructor parameter MUST supply a value, even if that
> value is NULL.  There is no
> avoiding this.  The runtime MUST pass in some value when it invokes the
> constructor.  This is the reason
> behind the requirement for required=true on the @Property annotation.
The
> using component can set
> any value it likes for the property - potentially including "nil" - but
it
> must set something.
>
> On the point that Raymond makes that the property value "can be inherited
> from the componentType" - this
> is not correct.  The componentType is entirely derived from the
> implementation itself, not from some other
> metadata.  In fact, there is no separate componentType file any longer
for
> Java implementations.  So the
> <vamsi>
> Have we done away with componentType side files for Java implementations?
> Is there an issue resolution pending to be applied?  In
> sca-javaci-1.1-spec-wd02.pdf, section 10, lines 509 thru 512, I still see
a
> description of componentType side file for Java implementations.  What am
I
> missing?
> </vamsi>
> only place for a property value to come from for a constructor parameter
is
> from the component configuration
> that uses the Java implementation.
>
>
> Yours,  Mike.
>
> Strategist - Emerging Technologies, SCA & SDO.
> Co Chair OASIS SCA Assembly TC.
> IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain.
> Phone & FAX: +44-1962-818014    Mobile: +44-7802-467431
> Email:  mike_edwards@uk.ibm.com
>
>
>
> From:     Raymond Feng <rfeng@us.ibm.com>
>
> To:       sca-j@lists.oasis-open.org
>
> Date:     23/02/2009 21:09
>
> Subject:  Re: [sca-j] Why is @Property.required attribute MUST be true
>           for constructor parameter?
>
>
>
>
>
>
>
> My understanding is that @required=true means the property MUST be set
with
> a value which can be either configured at the component level or
inherited
> from the componentType.
>
> For example, if we have a constructor as follows:
>
> public MyServiceImpl(@Property(name="myProp") String myProp) {
>        ...
> }
>
> The injection for "myProp" is required no matter what value it is set.
>
> Thanks,
> Raymond
>
>
>
>
> From:   C Vamsi <vamsic007@in.ibm.com>
>
> To:     sca-j@lists.oasis-open.org
>
> Date:   02/23/2009 10:41 AM
>
> Subject [sca-j] Why is @Property.required attribute MUST be true for
> :       constructor parameter?
>
>
>
>
>
>
>
>
> sca-javacaa-1.1-spec-cd02-rev2.doc:
>
> Sec 9.15 @Property
>
> Lines 1622-1623:
> required (optional) – specifies whether injection is required, defaults
to
> true. For a constructor parameter annotation, this attribute MUST have
the
> value true.
>
> Q: Why is, "For a constructor parameter annotation, this attribute MUST
> have the value true." required?
>
> The componentType can define a default value for the property. In this
> case, even if a property is not specified in the component definition,
the
> runtime will still have a value to pass as an argument to the
constructor.
>
>
> ++Vamsi
> Apache Tuscany Committer  http://tuscany.apache.org
> <http://tuscany.apache.org/>
> Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org
> <http://geronimo.apache.org/>
>
>
>
>
>
>
>
>
>
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> /
> /
>
> /Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU/
>
>
>
>
>
>



---------------------------------------------------------------------
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



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]