Re: [osgi-dev] Scanning classes at runtime

2019-01-23 Thread Tim Ward via osgi-dev
Depending on how much control you have over the bundles providing the types you 
could also look at providing your own extender capabiltiy/requirement model 
which would further restrict your search space, and potentially allow further 
optimisations. You should take a look at the OSGi CDI specification from the 
enterprise R7 release (currently in draft) which does something very much like 
this.

Tim

> On 23 Jan 2019, at 16:48, Tim Ward  wrote:
> 
> 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 
>> mailto: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
>>  
>> ___
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org 
>> 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

Re: [osgi-dev] Scanning classes at runtime

2019-01-23 Thread Thomas Driessen via osgi-dev

Thanks Tim!
That's exactly what I hoped for :)

Kind regards,
Thomas

-- Originalnachricht --
Von: "Tim Ward" 
An: "Thomas Driessen" ; "OSGi Developer 
Mail List" 

Gesendet: 23.01.2019 17:48:43
Betreff: Re: [osgi-dev] Scanning classes at runtime


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 
 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

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
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

Re: [osgi-dev] Scanning classes at runtime

2019-01-23 Thread Tim Ward via osgi-dev
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 
>  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
>  
> ___
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org 
> 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

[osgi-dev] Scanning classes at runtime

2019-01-23 Thread Thomas Driessen via osgi-dev

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___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev