Declarative Services, loading from <ACTIVE bundles

View: New views
5 Messages — Rating Filter:   Alert me  

Declarative Services, loading from <ACTIVE bundles

by lukewpatterson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm fumbling my way through Declarative Services, gleaning knowledge from here and there.  I've been trying to figure things out, but I think it's time to ask for help.

The problem is, when I chose DS for my service registration mechanism, I was under the impression that all "INSTALLED" impl bundles would automatically be registered.  After further reading, it seems that only "ACTIVE" bundles are registered.

I guess my questions are:

* Is the following page
http://www.eclipsezone.com/articles/extensions-vs-services/ 
correct when it says "All service component XML files declared through the Service- Component manifest entry are automatically registered." ?  Based on that description, the behavior sounds like Extensions "All <extension> nodes in the plugin.xml are automatically registered.", which definitely allow registration of >=INSTALLED bundles.

* If only ACTIVE bundles are registered, how can I work around this fact and search all INSTALLED bundles?  My consuming bundle needs to be able to retrieve impls from any >=INSTALLED bundle.


Thanks,

Luke

Re: Declarative Services, loading from <ACTIVE bundles

by Felix Meschberger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Luke

lukewpatterson schrieb:

> Hi,
>
> I'm fumbling my way through Declarative Services, gleaning knowledge from
> here and there.  I've been trying to figure things out, but I think it's
> time to ask for help.
>
> The problem is, when I chose DS for my service registration mechanism, I was
> under the impression that all "INSTALLED" impl bundles would automatically
> be registered.  After further reading, it seems that only "ACTIVE" bundles
> are registered.
>
> I guess my questions are:
>
> * Is the following page
> http://www.eclipsezone.com/articles/extensions-vs-services/ 
> correct when it says "All service component XML files declared through the
> Service- Component manifest entry are automatically registered." ?  Based on
> that description, the behavior sounds like Extensions "All <extension> nodes
> in the plugin.xml are automatically registered.", which definitely allow
> registration of >=INSTALLED bundles.

It is true, the DS descriptors are automatically picked up. But only of
ACTIVE (or in case of lazy activated bundles ACTIVATING) state. The
reson for this is, that INSTALLED bundles are just present in the
framework but not resolved (wired) and thus not directly usable. They
are just there.

Activing bundles is part of the bundle lifecycle and bundles need to be
active for the to be usable -- classes may be used while the bundle is
in the resolved state, but only when the bundles are started will the
descriptors be taken up and all the other activation tasks take place.

>
> * If only ACTIVE bundles are registered, how can I work around this fact and
> search all INSTALLED bundles?  My consuming bundle needs to be able to
> retrieve impls from any >=INSTALLED bundle.

You can access INSTALLed bundles by retrieving them from the
BundleContext. But you will not be able to load any classes or resources
from that bundle until the bundle has at least been resolved. Components
will only be registered and usable when the bundle is being started.

Let me ask one question: Why do you want to access components from
INSTALLed bundles ?

Regards
Felix

>
>
> Thanks,
>
> Luke

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Declarative Services, loading from <ACTIVE bundles

by lukewpatterson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 5, 2009, at 6:46 PM, Felix Meschberger <fmeschbe@...>
> Let me ask one question: Why do you want to access components from
> INSTALLed bundles ?
>
> Regards
> Felix

Thanks for the quick reply, Felix.

I'm trying to replace (in a fairly direct manner) Extensions/
plugin.xml lookups with DS. With plugin.xml route, I can get my impls  
from any installed bundle, and the impl bundle will be activated when  
I retrieve  a service from it.

Sent from my email client

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Declarative Services, loading from <ACTIVE bundles

by Felix Meschberger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Luke Patterson schrieb:

> On Nov 5, 2009, at 6:46 PM, Felix Meschberger <fmeschbe@...>
>> Let me ask one question: Why do you want to access components from
>> INSTALLed bundles ?
>>
>> Regards
>> Felix
>
> Thanks for the quick reply, Felix.
>
> I'm trying to replace (in a fairly direct manner) Extensions/plugin.xml
> lookups with DS. With plugin.xml route, I can get my impls from any
> installed bundle, and the impl bundle will be activated when I retrieve
> a service from it.

In this case I suggest you declare your bundle with lazy activation
policy and just start the bundles. The bundles will then not really be
started.

Next you should declare you component services to be delayed, such that
they are only instantiated when really used. This would also cause your
bundles to only be really started (class loaders created, activators
called) upon first use.

Regards
Felix

>
> Sent from my email client
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Declarative Services, loading from <ACTIVE bundles

by lukewpatterson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Felix Meschberger-2 wrote:
In this case I suggest you declare your bundle with lazy activation
policy and just start the bundles. The bundles will then not really be
started.
Thanks Felix.  I think I'll have to go a slightly different route than DS cause in the downstream deployed products I won't have control over which bundles are started and I don't want to unnecessarily start (programmatically) any bundles.

Luke