karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Soto <alex.s...@envieta.com>
Subject Re: SCR Reference annotation on field
Date Wed, 24 Aug 2016 14:02:53 GMT
Thanks again for the help.  

Coming new to DS, I could not find this information anywhere. Perhaps is my fault for not
knowing where to look. I downloaded the official OSGi Alliance documents, and they are a great
resource, but when it comes to simple stuff like how to set up your project from scratch,
and which Maven artifacts to use, etc., I could not find this information.


Best regards,
Alex soto


> On Aug 24, 2016, at 9:37 AM, Tim Ward <tim.ward@paremus.com> wrote:
> 
> Release 6 was the first release with formal Maven artifacts delivered by the OSGi alliance.
All the others were uploaded by helpful members, but didn't always match the internal names
of the OSGi build artifacts.
> 
> The other new thing that release 6 offers is individual spec jars (so you don't have
to use the entire API at a single release version). The org.osgi.service.component.annotations
artifacts contains just the DS annotations.
> 
> Tim
> 
> Sent from my iPhone
> 
> On 24 Aug 2016, at 14:13, Alex Soto <alex.soto@envieta.com <mailto:alex.soto@envieta.com>>
wrote:
> 
>> Ha!  They renamed the artifact, that is why I could never find it.
>> 
>> Version 5 was: 
>> 
>> 		<groupId>org.osgi</groupId>
>>   		<artifactId>org.osgi.compendium</artifactId>
>> 
>> And Version 6 is:
>> 
>>     <groupId>org.osgi</groupId>
>>     <artifactId>osgi.cmpn</artifactId>
>> 
>> Not sure who decided that the abbreviated form was such an improvement. Saving a
few bytes in the name helps anybody?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Aug 24, 2016, at 8:57 AM, Alex Soto <alex.soto@envieta.com <mailto:alex.soto@envieta.com>>
wrote:
>>> 
>>> Thank you Tim,  I knew the version was probably the issue, but I could not find
version 6 of org.osgi.compendium  in any of the public Maven repositories.
>>> Do you know of a public Maven repository where I can get the artifact?
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>>> On Aug 23, 2016, at 6:32 PM, Tim Ward <tim.ward@paremus.com <mailto:tim.ward@paremus.com>>
wrote:
>>>> 
>>>> This is absolutely correct. 
>>>> 
>>>> The "Release 6" version of declarative services supports field injection.
The "Release 5" version that you are depending on does not!
>>>> 
>>>> Regards,
>>>> 
>>>> Tim
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>> On 23 Aug 2016, at 22:43, Alex Soto <alex.soto@envieta.com <mailto:alex.soto@envieta.com>>
wrote:
>>>> 
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I am new SCR, but based on the "The OSGi Alliance OSGi Compendium, Release
6 July 2015"  the Reference annotation can be applied to fields.
>>>>> @Reference
>>>>> 
>>>>> Identify the annotated member as a reference of a Service Component.
When the annotation is applied to a method, the method is the bind method of the reference.
When the annotation is applied to a field, the field will contain the bound service(s) of
the reference. This annotation is not processed at runtime by Service Component Runtime. It
must be processed by tools and used to add a Component Description to the bundle. In the generated
Component Description for a component, the references must be ordered in ascending lexicographical
order (using String.compareTo ) of the reference names.
>>>>> 
>>>>> The reference element of a Component Description. CLASS
>>>>> METHOD,FIELD 
>>>>> 
>>>>> 
>>>>> 
>>>>> However, the actual jar declaring this annotation from Maven import:

>>>>> 
>>>>>   <groupId>org.osgi</groupId>
>>>>>   <artifactId>org.osgi.compendium</artifactId>
>>>>>   <version>5.0.0</version>
>>>>> Does not support Field, only Method.  So I can’t apply the @Reference
annotation to fields.
>>>>> 
>>>>> What am I missing? 
>>>>> 
>>>>> Best regards,
>>>>> 
>>>>> Alex soto
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>> 
>> 


Mime
View raw message