You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Vamsavardhana Reddy (JIRA)" <tu...@ws.apache.org> on 2008/04/03 13:18:24 UTC

[jira] Commented: (TUSCANY-2165) Java runtime should inject service references to field with common name in absence of @Reference

    [ https://issues.apache.org/jira/browse/TUSCANY-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585048#action_12585048 ] 

Vamsavardhana Reddy commented on TUSCANY-2165:
----------------------------------------------

Java Component Implementation Specification v 1.0 lines 358 to 365:

358 1.2.7. Semantics of an Unannotated Implementation
359 The section defines the rules for determining properties and references for a Java component
360 implementation that does not explicitly declare them using @Reference or @Property.
361 In the absence of @Property and @Reference annotations, the properties and references of a class are
362 defined according to the following rules:
363 1. Public setter methods that are not included in any interface specified by an @Service annotation.
364 2. Protected setter methods
365 3. Public or protected fields unless there is a public or protected setter method for the same name

Does this mean that if either an @Property or @Reference annotation is used in the implementation, rest of the unannotated fields and setter methods should simply be ignored?  If yes, (which is the current implementation in tuscany) b4 and b5 in org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl will never make into the componentType as references and there is no question of injection.  We will need AnotherAServiceImpl in which none of the fields and setter methods are annotated so that b4 and b5 will be computed as references.

Am I missing anything?


> Java runtime should inject service references to field with common name in absence of @Reference 
> -------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-2165
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2165
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-Next
>            Reporter: Kevin Williams
>            Assignee: Vamsavardhana Reddy
>            Priority: Minor
>
> The Java Annotations&APIs specification Lines 1407, 1408, 1409, 1410 ...
>      * References may also be injected via public setter methods even when the
>      * "@Reference" annotation is not present. However, the "@Reference"
>      * annotation must be used in order to inject a reference onto a non public
>      * field. In the case where there is no "@Reference" annotation, the name of
>      * the reference is the same as the name of the field or setter.
> The vTest:  org.apache.tuscany.sca.vtest.javaapi.ReferenceAnnotationTestCase.atReference2 demonstrates this issue

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Re: [jira] Commented: (TUSCANY-2165) Java runtime should inject service references to field with common name in absence of @Reference

Posted by Raymond Feng <en...@gmail.com>.
Hi,

I think the SCA spec needs to define what java implementation classes 
qualify for "Unannotated Implementation".

I could write an component impl as follows:

public class MyServiceImpl implements MyService {
...
}

@Remotable
public interface MyService {
...
}

Is MyServiceImpl satisfying "no annotations at all"?

There is also a related JIRA opened in this area: 
http://www.osoa.org/jira/browse/JAVA-17.

Thanks,
Raymond

--------------------------------------------------
From: "Simon Nash" <na...@apache.org>
Sent: Thursday, April 03, 2008 7:30 AM
To: <tu...@ws.apache.org>
Subject: Re: [jira] Commented: (TUSCANY-2165) Java runtime should inject 
service references to field with common name in absence of @Reference

> Vamsavardhana Reddy (JIRA) wrote:
>>     [ 
>> https://issues.apache.org/jira/browse/TUSCANY-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585048#action_12585048 ] 
>> Vamsavardhana Reddy commented on TUSCANY-2165:
>> ----------------------------------------------
>>
>> Java Component Implementation Specification v 1.0 lines 358 to 365:
>>
>> 358 1.2.7. Semantics of an Unannotated Implementation
>> 359 The section defines the rules for determining properties and 
>> references for a Java component
>> 360 implementation that does not explicitly declare them using @Reference 
>> or @Property.
>> 361 In the absence of @Property and @Reference annotations, the 
>> properties and references of a class are
>> 362 defined according to the following rules:
>> 363 1. Public setter methods that are not included in any interface 
>> specified by an @Service annotation.
>> 364 2. Protected setter methods
>> 365 3. Public or protected fields unless there is a public or protected 
>> setter method for the same name
>>
>> Does this mean that if either an @Property or @Reference annotation is 
>> used in the implementation, rest of the unannotated fields and setter 
>> methods should simply be ignored?  If yes, (which is the current 
>> implementation in tuscany) b4 and b5 in 
>> org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl 
>> will never make into the componentType as references and there is no 
>> question of injection.  We will need AnotherAServiceImpl in which none of 
>> the fields and setter methods are annotated so that b4 and b5 will be 
>> computed as references.
>>
>> Am I missing anything?
>>
> I believe section 1.2.7 is about implementations with no annotations
> at all.  Therefore it does not apply if any annotations are present.
>
>   Simon
>>
>>> Java runtime should inject service references to field with common name 
>>> in absence of 
>>> @Reference -------------------------------------------------------------------------------------------------
>>>
>>>                 Key: TUSCANY-2165
>>>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2165
>>>             Project: Tuscany
>>>          Issue Type: Bug
>>>          Components: Java SCA Core Runtime
>>>    Affects Versions: Java-SCA-Next
>>>            Reporter: Kevin Williams
>>>            Assignee: Vamsavardhana Reddy
>>>            Priority: Minor
>>>
>>> The Java Annotations&APIs specification Lines 1407, 1408, 1409, 1410 ...
>>>      * References may also be injected via public setter methods even 
>>> when the
>>>      * "@Reference" annotation is not present. However, the "@Reference"
>>>      * annotation must be used in order to inject a reference onto a non 
>>> public
>>>      * field. In the case where there is no "@Reference" annotation, the 
>>> name of
>>>      * the reference is the same as the name of the field or setter.
>>> The vTest: 
>>> org.apache.tuscany.sca.vtest.javaapi.ReferenceAnnotationTestCase.atReference2 
>>> demonstrates this issue
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 

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


Re: [jira] Commented: (TUSCANY-2165) Java runtime should inject service references to field with common name in absence of @Reference

Posted by Simon Nash <na...@apache.org>.
Vamsavardhana Reddy (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/TUSCANY-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585048#action_12585048 ] 
> 
> Vamsavardhana Reddy commented on TUSCANY-2165:
> ----------------------------------------------
> 
> Java Component Implementation Specification v 1.0 lines 358 to 365:
> 
> 358 1.2.7. Semantics of an Unannotated Implementation
> 359 The section defines the rules for determining properties and references for a Java component
> 360 implementation that does not explicitly declare them using @Reference or @Property.
> 361 In the absence of @Property and @Reference annotations, the properties and references of a class are
> 362 defined according to the following rules:
> 363 1. Public setter methods that are not included in any interface specified by an @Service annotation.
> 364 2. Protected setter methods
> 365 3. Public or protected fields unless there is a public or protected setter method for the same name
> 
> Does this mean that if either an @Property or @Reference annotation is used in the implementation, rest of the unannotated fields and setter methods should simply be ignored?  If yes, (which is the current implementation in tuscany) b4 and b5 in org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl will never make into the componentType as references and there is no question of injection.  We will need AnotherAServiceImpl in which none of the fields and setter methods are annotated so that b4 and b5 will be computed as references.
> 
> Am I missing anything?
> 
I believe section 1.2.7 is about implementations with no annotations
at all.  Therefore it does not apply if any annotations are present.

   Simon
> 
>> Java runtime should inject service references to field with common name in absence of @Reference 
>> -------------------------------------------------------------------------------------------------
>>
>>                 Key: TUSCANY-2165
>>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2165
>>             Project: Tuscany
>>          Issue Type: Bug
>>          Components: Java SCA Core Runtime
>>    Affects Versions: Java-SCA-Next
>>            Reporter: Kevin Williams
>>            Assignee: Vamsavardhana Reddy
>>            Priority: Minor
>>
>> The Java Annotations&APIs specification Lines 1407, 1408, 1409, 1410 ...
>>      * References may also be injected via public setter methods even when the
>>      * "@Reference" annotation is not present. However, the "@Reference"
>>      * annotation must be used in order to inject a reference onto a non public
>>      * field. In the case where there is no "@Reference" annotation, the name of
>>      * the reference is the same as the name of the field or setter.
>> The vTest:  org.apache.tuscany.sca.vtest.javaapi.ReferenceAnnotationTestCase.atReference2 demonstrates this issue
> 


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