Re: [Question] API Regions Report

2021-08-23 Thread Daniel Klco
There's a reason for that. :-) I revised the script following your email.

Rev 1 used reflection to construct a new RegionConfiguration using the
BundleContext.

On Mon, Aug 23, 2021, 3:04 AM David Bosschaert 
wrote:

> Hi Daniel,
>
> Only looked at your groovy script after I wrote the mail and I see that it
> does pretty much exactly what I described :)
> The RegionConfiguration class also allows dynamic changes to the
> configuration which can be found via ConfigAdmin.
>
> Cheers,
>
> David
>
> On Sun, 22 Aug 2021 at 22:49, David Bosschaert 
> wrote:
>
>> Hi Daniel,
>>
>> You can find the API Regions definitions via the ResolverHookFactory
>> service that implements the API Regions at runtime. Just look for the
>> ResolverHookFactory service and then check its *.properties service
>> registration properties. They contain the full path of the associated files:
>>
>> [org.osgi.framework.hooks.resolver.ResolverHookFactory]
>> bundles.properties=.../bundles.properties
>> features.properties=.../features.properties
>> idbsnver.properties=.../idbsnver.properties
>> regions.properties=.../regions.properties
>>
>> These files are the definition of the API Regions behaviour, so you can
>> use them to generate a report, or look at them to see how the service is
>> configured.
>>
>> Kind regards,
>>
>> David
>>
>>
>> On Sun, 22 Aug 2021 at 18:49, Daniel Klco  wrote:
>>
>>> All,
>>>
>>> Is there a way to see a report on the API regions for an instance as a
>>> consumer / extender of Sling?
>>>
>>> It seems like all of the information you'd need is in the API Regions
>>> Runtime RegionConfiguration[1] class, but that's not in an exposed
>>> package.
>>>
>>> The case I'm thinking of is if you are a customizer of a Sling-based app
>>> and are importing a package that was not exposed in the API region of
>>> your
>>> bundle, how would you diagnose why the package is not resolving even
>>> though
>>> it is exported? If you don't have direct access to the model used to
>>> create
>>> that app (or if you aren't familiar with reading model files), I can't
>>> see
>>> how you could diagnose the issue.
>>>
>>> I wrote up a groovy script to dump this configuration, but, it's more
>>> than
>>> a little hack-y:
>>> https://gist.github.com/klcodanr/28385db0ce6df72be36a4f60b433a8ec
>>>
>>> If there's not a good way currently, would others see value in having a
>>> status web console to dump this information?
>>>
>>> -Dan
>>>
>>> [1]
>>>
>>> https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/master/src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java
>>>
>>


Re: [Question] API Regions Report

2021-08-23 Thread David Bosschaert
Hi Daniel,

Only looked at your groovy script after I wrote the mail and I see that it
does pretty much exactly what I described :)
The RegionConfiguration class also allows dynamic changes to the
configuration which can be found via ConfigAdmin.

Cheers,

David

On Sun, 22 Aug 2021 at 22:49, David Bosschaert 
wrote:

> Hi Daniel,
>
> You can find the API Regions definitions via the ResolverHookFactory
> service that implements the API Regions at runtime. Just look for the
> ResolverHookFactory service and then check its *.properties service
> registration properties. They contain the full path of the associated files:
>
> [org.osgi.framework.hooks.resolver.ResolverHookFactory]
> bundles.properties=.../bundles.properties
> features.properties=.../features.properties
> idbsnver.properties=.../idbsnver.properties
> regions.properties=.../regions.properties
>
> These files are the definition of the API Regions behaviour, so you can
> use them to generate a report, or look at them to see how the service is
> configured.
>
> Kind regards,
>
> David
>
>
> On Sun, 22 Aug 2021 at 18:49, Daniel Klco  wrote:
>
>> All,
>>
>> Is there a way to see a report on the API regions for an instance as a
>> consumer / extender of Sling?
>>
>> It seems like all of the information you'd need is in the API Regions
>> Runtime RegionConfiguration[1] class, but that's not in an exposed
>> package.
>>
>> The case I'm thinking of is if you are a customizer of a Sling-based app
>> and are importing a package that was not exposed in the API region of your
>> bundle, how would you diagnose why the package is not resolving even
>> though
>> it is exported? If you don't have direct access to the model used to
>> create
>> that app (or if you aren't familiar with reading model files), I can't see
>> how you could diagnose the issue.
>>
>> I wrote up a groovy script to dump this configuration, but, it's more than
>> a little hack-y:
>> https://gist.github.com/klcodanr/28385db0ce6df72be36a4f60b433a8ec
>>
>> If there's not a good way currently, would others see value in having a
>> status web console to dump this information?
>>
>> -Dan
>>
>> [1]
>>
>> https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/master/src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java
>>
>