Hi Am Donnerstag, den 28.02.2008, 08:32 +0100 schrieb Carsten Ziegeler: > Felix Meschberger wrote: > > Hi, > > > > Am Mittwoch, den 27.02.2008, 09:31 -0800 schrieb Carsten Ziegeler > > (JIRA): > >> A script gets a service locator in the form of the sling script helper > >> passed into. Currently this locator is > >> using the bundle context of the scripting resolver bundle to resolve > >> services. > >> The bundle context of the script should be used instead. > > > > The question is probably, how to get a the BundleContext: > > > :) Yes, that's why I didn't implement it yet :) > Perhaps it's not that important to achieve this?
Probably not, as we do not make use of OSGi security (yet ???), it is probably not that important.... > > > * What is the bundle context of a script stored in the JCR > > repository ? > If the script has been added by a bundle (through the included content) > we could perhaps set a property indicating to which bundle this script > belongs? I'm not sure if this opens possible misuse. Not sure, where we would want to store that information - per-script ? In addition, after loading the script into the repository it is detached from the bundle and may be modified at will - thus we would open a big hole here, provided security would be an issue. But then we would probably also close down the possibility to modify scripts in the repository ... > > > > > * How to get at the bundle context (or the bundle) for scripts > > provided by bundles ? > In this case we should have a ServiceReference and can get the bundle > from there. Or am I missing something? Ah, yeah, right. The BundleResource is provided by the BundlResourceProvider, which is a registered service, so there is a ServiceReference (and even a ServiceRegistration). Not sure, how we get at that Bundle[Context], though, because BundleResource.adaptTo(Bundle.class) is equally wrong as JcrNodeResource.adaptTo(Session.class). Regards Felix
