You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Alex Sviridov <oo...@mail.ru> on 2015/07/18 19:01:00 UTC
Re[2]: How to connect 2 declarative services?
Thank you for your answer. Could you provide an example on my example - as all is in development process and I can find old information.
I am sure that the example will be very short but we will understand what you mean at 100%.
>Суббота, 18 июля 2015, 17:02 +01:00 от Neil Bartlett <nj...@gmail.com>:
>
>Hi Alex, you can use the @Reference annotation.
>
>Neil
>
>On Saturday, 18 July 2015 at 13:46, Alex Sviridov wrote:
>>I use org.apache.felix.framework-4.6.1.jar and a bundle org.apache.felix.scr-1.8.3-SNAPSHOT.jar
>>
>>And I have two bundles - bundleA and bundleB. => totally I have three bundles (A,B,scr)
>>
>>And in every bundle I have one declarative service. For creating DS I use annotations + maven bundle plugin.
>>
>>How can I use connect one service to another other using DS annotations + maven bundle plugin. I mean:
>>
>>BundleA #############################################################################################
>>import org.osgi.service.component.annotations.Component;
>>import org.osgi.service.component.annotations.ServiceScope;
>>
>>@Component(
>> immediate = false,
>> property={"label=defaultA"},
>> scope=ServiceScope.PROTOTYPE
>>)
>>public class ClassA implements InterfaceA{
>>......
>>}
>>
>>BundleB #############################################################################################
>>import org.osgi.service.component.annotations.Component;
>>import org.osgi.service.component.annotations.ServiceScope;
>>
>>@Component(
>> immediate = false,
>> property={"label=defaultB"},
>> scope=ServiceScope.PROTOTYPE
>>)
>>public class ClassB implements InterfaceB{
>>
>> private InterfaceA aService; // HOW CAN I MAKE OSGI "INJECT" HERE SERVICE A WITH LABEL=DEFAULTA???
>> .....
>>}
>>
>>
>>
>>--
>>Alex Sviridov
>
--
Alex Sviridov
Re[4]: How to connect 2 declarative services?
Posted by Alex Sviridov <oo...@mail.ru>.
Oh! Thank you very much!
>Суббота, 18 июля 2015, 19:18 +02:00 от peter.kriens@aqute.biz:
>
>http://enroute.osgi.org/services/org.osgi.service.component.html
>
>
>Sent from my iPhone
>
>> On 18 Jul 2015, at 19:01, Alex Sviridov < ooo_saturn7@mail.ru > wrote:
>>
>> Thank you for your answer. Could you provide an example on my example - as all is in development process and I can find old information.
>>
>> I am sure that the example will be very short but we will understand what you mean at 100%.
>>
>>
>>> Суббота, 18 июля 2015, 17:02 +01:00 от Neil Bartlett < njbartlett@gmail.com >:
>>>
>>> Hi Alex, you can use the @Reference annotation.
>>>
>>> Neil
>>>
>>>> On Saturday, 18 July 2015 at 13:46, Alex Sviridov wrote:
>>>> I use org.apache.felix.framework-4.6.1.jar and a bundle org.apache.felix.scr-1.8.3-SNAPSHOT.jar
>>>>
>>>> And I have two bundles - bundleA and bundleB. => totally I have three bundles (A,B,scr)
>>>>
>>>> And in every bundle I have one declarative service. For creating DS I use annotations + maven bundle plugin.
>>>>
>>>> How can I use connect one service to another other using DS annotations + maven bundle plugin. I mean:
>>>>
>>>> BundleA #############################################################################################
>>>> import org.osgi.service.component.annotations.Component;
>>>> import org.osgi.service.component.annotations.ServiceScope;
>>>>
>>>> @Component(
>>>> immediate = false,
>>>> property={"label=defaultA"},
>>>> scope=ServiceScope.PROTOTYPE
>>>> )
>>>> public class ClassA implements InterfaceA{
>>>> ......
>>>> }
>>>>
>>>> BundleB #############################################################################################
>>>> import org.osgi.service.component.annotations.Component;
>>>> import org.osgi.service.component.annotations.ServiceScope;
>>>>
>>>> @Component(
>>>> immediate = false,
>>>> property={"label=defaultB"},
>>>> scope=ServiceScope.PROTOTYPE
>>>> )
>>>> public class ClassB implements InterfaceB{
>>>>
>>>> private InterfaceA aService; // HOW CAN I MAKE OSGI "INJECT" HERE SERVICE A WITH LABEL=DEFAULTA???
>>>> .....
>>>> }
>>>>
>>>>
>>>>
>>>> --
>>>> Alex Sviridov
>>
>>
>> --
>> Alex Sviridov
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>
--
Alex Sviridov
Re: Re[2]: How to connect 2 declarative services?
Posted by pe...@aqute.biz.
http://enroute.osgi.org/services/org.osgi.service.component.html
Sent from my iPhone
> On 18 Jul 2015, at 19:01, Alex Sviridov <oo...@mail.ru> wrote:
>
> Thank you for your answer. Could you provide an example on my example - as all is in development process and I can find old information.
>
> I am sure that the example will be very short but we will understand what you mean at 100%.
>
>
>> Суббота, 18 июля 2015, 17:02 +01:00 от Neil Bartlett <nj...@gmail.com>:
>>
>> Hi Alex, you can use the @Reference annotation.
>>
>> Neil
>>
>>> On Saturday, 18 July 2015 at 13:46, Alex Sviridov wrote:
>>> I use org.apache.felix.framework-4.6.1.jar and a bundle org.apache.felix.scr-1.8.3-SNAPSHOT.jar
>>>
>>> And I have two bundles - bundleA and bundleB. => totally I have three bundles (A,B,scr)
>>>
>>> And in every bundle I have one declarative service. For creating DS I use annotations + maven bundle plugin.
>>>
>>> How can I use connect one service to another other using DS annotations + maven bundle plugin. I mean:
>>>
>>> BundleA #############################################################################################
>>> import org.osgi.service.component.annotations.Component;
>>> import org.osgi.service.component.annotations.ServiceScope;
>>>
>>> @Component(
>>> immediate = false,
>>> property={"label=defaultA"},
>>> scope=ServiceScope.PROTOTYPE
>>> )
>>> public class ClassA implements InterfaceA{
>>> ......
>>> }
>>>
>>> BundleB #############################################################################################
>>> import org.osgi.service.component.annotations.Component;
>>> import org.osgi.service.component.annotations.ServiceScope;
>>>
>>> @Component(
>>> immediate = false,
>>> property={"label=defaultB"},
>>> scope=ServiceScope.PROTOTYPE
>>> )
>>> public class ClassB implements InterfaceB{
>>>
>>> private InterfaceA aService; // HOW CAN I MAKE OSGI "INJECT" HERE SERVICE A WITH LABEL=DEFAULTA???
>>> .....
>>> }
>>>
>>>
>>>
>>> --
>>> Alex Sviridov
>
>
> --
> Alex Sviridov
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org