What framework do you use that implements the @PostPersist?

Generally you can use

|final  BundleContext  bundleContext=  
FrameworkUtil.getBundle(this.getClass()).getBundleContext();

You then can for example create a ServiceTracker from there. This means to attach to 
services "by hand" though.

You might be able to use a static reference to a an object that is wired using 
your framework of choice.
|


Christian

On 18.06.2015 17:40, ellirael wrote:
I'm looking for best solution to gain access to OSGi services in classes
which object creation I cannot handle.
For example I need to call some OSGi services in JPA event listener
@PostPersist callback method.
How to inject services to such objects?
How to refresh services links when their implementation change?
How to ensure that all resources are freed when I update or restart bundle
with services?
To save dynamism is a must for my tasks.



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Best-way-to-access-OSGi-services-from-classes-which-object-creation-I-cannot-handle-tp4040986.html
Sent from the Karaf - User mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to