I am sorry for not being sufficiently precise, I didn¹t mean annotation, I
meant Component property

        @Component(properties={"property1=value"})


Based on the value of property1, I will check if the service component
should be in the state ACTIVE or STATE_UNSATISFIED

The actual use case is to check if a message queue was in a messaging
middleware was previously setup. If not, the service (EventHandler) should
not startup.


On 5/5/15, 6:00 PM, "osgi-dev-requ...@mail.osgi.org"
<osgi-dev-requ...@mail.osgi.org> wrote:

>Send osgi-dev mailing list submissions to
>       osgi-dev@mail.osgi.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>       https://mail.osgi.org/mailman/listinfo/osgi-dev
>or, via email, send a message with subject or body 'help' to
>       osgi-dev-requ...@mail.osgi.org
>
>You can reach the person managing the list at
>       osgi-dev-ow...@mail.osgi.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of osgi-dev digest..."
>
>
>Today's Topics:
>
>   1. Stop/disable OSGI component/service based on annotation
>      (Frank Langel)
>   2. Re: Stop/disable OSGI component/service based on annotation
>      (Neil Bartlett)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Tue, 05 May 2015 11:03:39 +0200
>From: Frank Langel <fr...@frankjlangel.com>
>To: <osgi-dev@mail.osgi.org>
>Subject: [osgi-dev] Stop/disable OSGI component/service based on
>       annotation
>Message-ID: <d16e540b.242c7%fr...@frankjlangel.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi,
>
>Here is the scenario I like to achieve
>1. I create a OSGI component/service X that has an annotation A1
>2. It has no dependencies or start/active methods
>3. Based on the value of A1, I like this service to be available or marked
>as STATE_UNSATISFIED when starting up
>How can I do this?
>*  ServiceTracker is not the answer I think. It doesn?t provide the
>ability
>to access the component context that would allow me to disable the service
>again, plus I think its not a good idea as there might be dependencies to
>be
>managed
>* I don?t want to add the logic in the activate method bc I want to apply
>it
>to all components with the annotation
>* Introspection in Activator : I could not use the component model
>directly,
>but search my bundle for all classes with this annotation, and start the
>service myself 
>* I cannot use service listener, as ServiceEvent does not expose an
>possibly
>to interfere when registering the service
>* Are service hocks the answer ?
>Thanks a lot in advance
>Frank
>
>
>
>
>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
><http://mail.osgi.org/pipermail/osgi-dev/attachments/20150505/27605ced/att
>achment-0001.html>
>
>------------------------------
>
>Message: 2
>Date: Tue, 5 May 2015 10:08:31 +0100
>From: Neil Bartlett <njbartl...@gmail.com>
>To: OSGi Developer Mail List <osgi-dev@mail.osgi.org>
>Subject: Re: [osgi-dev] Stop/disable OSGI component/service based on
>       annotation
>Message-ID: <f014f5c5-b64e-48e5-876a-a98b9fa29...@gmail.com>
>Content-Type: text/plain; charset="windows-1252"
>
>Hi Frank,
>
>Can you please clarify the meaning of point 3.
>
>?Based on the value of A1?? but this is an annotation on a class so is
>there any possibility for it to change during runtime? It seems that
>whatever the value of A1 is at compile time will determine forever
>whether that component is active or inactive. That can?t be what you mean
>though, so could you please elaborate a little further what you had in
>mind?
>
>Regards,
>Neil
>
>> On 5 May 2015, at 10:03, Frank Langel <fr...@frankjlangel.com> wrote:
>> 
>> Hi,
>> 
>> Here is the scenario I like to achieve
>> I create a OSGI component/service X that has an annotation A1
>> It has no dependencies or start/active methods
>> Based on the value of A1, I like this service to be available or marked
>>as STATE_UNSATISFIED when starting up
>> How can I do this?
>>  ServiceTracker is not the answer I think. It doesn?t provide the
>>ability to access the component context that would allow me to disable
>>the service again, plus I think its not a good idea as there might be
>>dependencies to be managed
>> I don?t want to add the logic in the activate method bc I want to apply
>>it to all components with the annotation
>> Introspection in Activator : I could not use the component model
>>directly, but search my bundle for all classes with this annotation, and
>>start the service myself
>> I cannot use service listener, as ServiceEvent does not expose an
>>possibly to interfere when registering the service
>> Are service hocks the answer ?
>> Thanks a lot in advance
>> Frank
>> 
>> 
>> 
>> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
><http://mail.osgi.org/pipermail/osgi-dev/attachments/20150505/2be8b590/att
>achment-0001.html>
>
>------------------------------
>
>_______________________________________________
>OSGi Developer Mail List
>osgi-dev@mail.osgi.org
>https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>End of osgi-dev Digest, Vol 103, Issue 2
>****************************************


_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to