Dear Karaf Team,
I inject the BundleContext using the Blueprint reference
ref="blueprintBundleContext". When I try to register a service to this context,
I get the following exception:
java.lang.IllegalStateException: Invalid BundleContext.
As it was injected, how can it be invalid?
Cheers,
JP
[@@ OPEN @@]
De : Guillaume Nodet [mailto:[email protected]]
Envoyé : mercredi 5 juin 2013 12:57
À : user
Objet : Re: service / reference-list within same bundle
Exactly, the container simply check the existence.
2013/6/5 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
Good.
What is the main difference between injecting directly the string, or injecting
an idref, just reference check ref existence before injection ?
JP
[@@ THALES GROUP INTERNAL @@]
De : Guillaume Nodet [mailto:[email protected]<mailto:[email protected]>]
Envoyé : mercredi 5 juin 2013 12:41
À : user
Objet : Re: service / reference-list within same bundle
Yes
2013/6/5 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
Ok, good.
Which kind of Java parameter type is injected for id-ref ? String?
JP
[@@ OPEN @@]
De : Guillaume Nodet [mailto:[email protected]<mailto:[email protected]>]
Envoyé : mercredi 5 juin 2013 11:42
À : user
Objet : Re: service / reference-list within same bundle
You can't inject a bean manager, but you can inject the id using id-ref="xyz",
inject the blueprint container using ref="blueprintContainer" and then
programmatically ask the blueprint container for beans (or eventually for the
metadata). That's how you can leverage prototypes programmatically.
2013/6/5 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
Guillaume,
Is there a way to inject a bean manager instead of a bean itself using
Blueprint?
Cheers,
JP
[@@ OPEN @@]
De : Guillaume Nodet [mailto:[email protected]<mailto:[email protected]>]
Envoyé : mardi 4 juin 2013 17:20
À : user
Objet : Re: service / reference-list within same bundle
If you don't need to iterator through osgi services, you could use a simple
<list> element instead.
The problem with using osgi services and references is that if the reference is
mandatory, the blueprint context won't be started until the reference is
satisfied, which can't happen since the the service will be provided by the
bundle itself. However, it should work when using an optional availability
instead.
2013/6/4 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
Yes, you are right, not exactly meant for but it is useful :)
In fact I just wish to iterate through beans and call a method for each bean.
What is strange is that it is possible among bundles but not within bundle :S
JP
[@@ OPEN @@]
De : Achim Nierbeck
[mailto:[email protected]<mailto:[email protected]>]
Envoyé : mardi 4 juin 2013 16:37
À : [email protected]<mailto:[email protected]>
Objet : Re: service / reference-list within same bundle
It's not what it's meant for, reference-list is supposed to give you all
available services of a interface.
Not exactly a for each, or?
regards, Achim
2013/6/4 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
In fact I would like to use the reference-list as a kind of "for each". I don't
know how to do the same thing using the bean.
Is there a syntax to do so?
Cheers,
JP
[@@ OPEN @@]
De : Achim Nierbeck
[mailto:[email protected]<mailto:[email protected]>]
Envoyé : mardi 4 juin 2013 16:31
À : [email protected]<mailto:[email protected]>
Objet : Re: service / reference-list within same bundle
Since you're referencing a bean from within the same bundle, it's probably best
to reference the bean and not the service of it.
If you really want to use the service (which I don't understand why) you should
configure Karaf to start the bundles in a synchronous way.
regards, Achim
2013/6/4 CLEMENT Jean-Philippe
<[email protected]<mailto:[email protected]>>
Dear Karaf team,
I would like to use a reference-list on a service which is exported in the same
bundle. Starting the bundle blocks on the GracePeriod state.
Is there a way to use a service which is exposed within the same bundle?
Cheers,
JP
[@@ OPEN @@]
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>