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

From
Mike Edwards <>
Date
2009-02-27T13:43:42+00:00
ID
Thread
Re: [sca-j] Why is @Property.required attribute MUST be true forconstructor parameter?
Dave,

Yes, I agree it's a dup.

Sorry, but I thought it had been removed
and then could not find that resolution you quote below.  Your memory
and search abilities

are better than mine  ;-)

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:  

From:
David Booz <>

To:


Date:
27/02/2009 12:53

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

Issue 87 Removed the chapter in question from the C&I

Excerpt from minutes of Jan 16:

[15:47] Vamsi: Motion: Resolve issue 87 by removing sec 10 from C&I
spec. seconded by Dave.

[15:47] Vamsi: m: Mike s: Dave

[15:47] Mike Edwards: Motion: Resolve Issue 87 by removing Chapter
10 from the Java C&I specification (WD02) - section title is

[15:47] Mike Edwards: 10Specifying the Component Type

I just applied 87 to the WD03 draft, so you'll see the chapter is gone
now.

Mike, your new issue is a DUP, I think.

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:

Mike
Edwards ---02/25/2009 06:16:05 AM---Vamsi, I don't feel strongly about
the case that you describe.

From:

Mike Edwards <>

To:



Date:

02/25/2009 06:16 AM

Subject:

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

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. 

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:  

From: 
C Vamsi <>

To: 
Mike Edwards/UK/IBM@IBMGB 

Cc: 
 

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

Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org

                    
                     
                     
        

           Mike Edwards        
                     
                   

           <mike_edwards@uk.    
                     
                  

           ibm.com>        
                     
                    To

                    
                
         

           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:  

                    
                     
                     
        

From:     C Vamsi <>    
                     
       

                    
                     
                     
        

To:       Mike Edwards/UK/IBM@IBMGB      
                     
          

                    
                     
                     
        

Cc:             
                     
         

                    
                     
                     
        

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

Apache Geronimo Committer and Member of PMC  http://geronimo.apache.org

           Mike Edwards

           <mike_edwards@uk.

           ibm.com>        
                     
                    To

                    
                

           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:  

From:     Raymond Feng <>

To:       

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

To:     

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

Apache Geronimo Committer and Member of PMC  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 

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