Hi,

On Mon, Apr 6, 2020 at 11:07 PM Daniel Klco <[email protected]> wrote:
>
> I'm looking into executing a Repoinit script from the classpath of a bundle
> upon installation using the references property, but can't work out the
> correct format....

So IIUC your scenario is as follows:

1) Your Bundle starts and contains a repoinit script S as a resource
2) The SlingRepository starts and you want it to use that script

So the question is "how to get a stable URL that points to S", is that
what you mean?

If yes I think the question is not repoinit-specific, it's more a
general OSGi question and I don't know the answer.

My understanding is that the Bundle.getResource(path) is one way to
get such a URL, maybe the only one, which AFAIK uses the "bundle:" URL
scheme.

As per [1] it looks like you cannot construct such URLs, only get them
from the Bundle object.

I don't know if there's another OSGi way of getting that URL for S.

Our Bundle Resources module provides a way to get a bundle:// URL by
adapting a Sling resource that points to a Bundle resource but I don't
think it helps here.

Another option would be to use the OSGi Extender model, adding code to
repoinit so that it scans bundles for a specific header that points to
repoinit scripts, like we do for content loading.

-Bertrand

[1] 
https://stackoverflow.com/questions/41905130/accessing-resource-from-osgi-bundle-bundle-scheme-in-the-url-lead-to-a-malforme
[2] 
https://sling.apache.org/documentation/bundles/bundle-resources-extensions-bundleresource.html

Reply via email to