Hi Martin

Thank you for you reply. I think you are right. I thought this way - every 
bundle has its own cdi container - > every bundle has its own BeanManager.
So, we need from different services which implement BeanManager find the 
specific service for certain bundle. Based on the link you provided I did:

           Bundle bundle=FrameworkUtil.getBundle(someClassFromBundleA);
            BundleContext bc=bundle.getBundleContext();
            String filter = "(&(objectClass=" + BeanManager.class.getName() 
+ ")(bundleId="+bundle.getBundleId()+"))";
            ServiceReference[] serviceReferences = 
bc.getServiceReferences((String)null,filter);
Seems to work...

On Thursday, 11 August 2016 11:44:37 UTC+3, Martin Jelen wrote:
>
> Hi "iJava",
>
> I asked myself the same question this week and looked at the source code 
> of PAX-CDI. The AbstractCdiContainer 
> <https://github.com/ops4j/org.ops4j.pax.cdi/blob/master/pax-cdi-spi/src/main/java/org/ops4j/pax/cdi/spi/AbstractCdiContainer.java>seems
>  
> to register the CDI BeanManager as an OSGi-Service with bundleId/symbolicName 
> properties (scroll down to the end of the source file). So you should be 
> able to look up the BeanManager for your CDI bundles.
>
> However, I haven't tried this yet myself, someone else may give you a 
> better answer.
>
> Regards
> Martin
>
> On Wednesday, August 10, 2016 at 12:53:14 PM UTC+2, iJava wrote:
>>
>> There is a bundle A and threre is class MyClass in bundle A.
>>
>> We suppose that pax-cdi+weld is on.
>>
>> Can can I get reference to BeanManager of the bundle A inside MyClass 
>> without using @Inject and other CDI annotations? 
>> Via osgi service? Or how?
>>
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to