Hi,

You can optimise this pretty heavily by using the bundle wirings to look for 
bundles which are wired to the same API packages as you (the one(s) that 
contain the relevant interface/supertype/annotation). This way you can avoid 
scanning bundles which can’t possibly contain relevant types.

Best Regards,

Tim

> On 23 Jan 2019, at 16:10, Thomas Driessen via osgi-dev 
> <osgi-dev@mail.osgi.org> wrote:
> 
> Hi,
> 
> for a project of mine I need to mimic the behavior of a 
> ServletContainerInitializer [1], but with the dynamism of OSGi in mind.
> 
> Therefore, I need to be able to find all classes that implement/extend a 
> specific class or are annotated with a specific annotation at runtime.
> 
> Is there a better way to do so that I'm not aware of than to scan each class 
> of every bundle? Are there maybe framework hooks that would help me 
> accomplish this?
> 
> I'm thankful for every hint you can provide.
> 
> Kind regards,
> Thomas
> 
> [1] 
> https://docs.oracle.com/javaee/6/api/javax/servlet/ServletContainerInitializer.html
>  
> <https://docs.oracle.com/javaee/6/api/javax/servlet/ServletContainerInitializer.html>_______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org>
> https://mail.osgi.org/mailman/listinfo/osgi-dev 
> <https://mail.osgi.org/mailman/listinfo/osgi-dev>
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to