You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Roy Teeuwen <ro...@teeuwen.be> on 2021/12/06 08:53:35 UTC

Re: [Question] API Regions Report

Wouldn't it be nice to build a web console interface for this? Looks very
cumbersome at the moment and after having talks with internal Adobe
customer support I can already tell you that even support doesn't know how
api regions work (I asked why a package was not exported in Global, and
they just showed me a screenshot of the package that it's between the
exported packages, but that doesn't mean anything anymore if its not in the
global api region)

Will think about how it should look like if I find the time

On Mon, Aug 23, 2021 at 2:02 PM Daniel Klco <dk...@apache.org> wrote:

> 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 <david.bosschaert@gmail.com
> >
> 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 <
> david.bosschaert@gmail.com>
> > 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 <dk...@apache.org> 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

Posted by Daniel Klco <dk...@apache.org>.
FYI I took a crack at adding a webconsole status screen for this:
https://github.com/apache/sling-org-apache-sling-feature-apiregions/pull/16/files.
You can see the format in one of the test artifacts:
https://github.com/apache/sling-org-apache-sling-feature-apiregions/blob/268b43b50f66518a236f345607bdc40c530a780b/src/test/resources/printer/populated.txt

More than happy to take suggestions or improvements, but it seems like it
tells you what you'd want to know as a developer.

On Mon, Dec 6, 2021 at 3:53 AM Roy Teeuwen <ro...@teeuwen.be> wrote:

> Wouldn't it be nice to build a web console interface for this? Looks very
> cumbersome at the moment and after having talks with internal Adobe
> customer support I can already tell you that even support doesn't know how
> api regions work (I asked why a package was not exported in Global, and
> they just showed me a screenshot of the package that it's between the
> exported packages, but that doesn't mean anything anymore if its not in the
> global api region)
>
> Will think about how it should look like if I find the time
>
> On Mon, Aug 23, 2021 at 2:02 PM Daniel Klco <dk...@apache.org> wrote:
>
> > 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 <
> david.bosschaert@gmail.com
> > >
> > 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 <
> > david.bosschaert@gmail.com>
> > > 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 <dk...@apache.org> 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
> > >>>
> > >>
> >
>