You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2008/02/27 18:31:53 UTC

[jira] Created: (SLING-284) Use bundle context of scripts for service locator aka sling script helper

Use bundle context of scripts for service locator aka sling script helper
-------------------------------------------------------------------------

                 Key: SLING-284
                 URL: https://issues.apache.org/jira/browse/SLING-284
             Project: Sling
          Issue Type: Bug
          Components: Scripting
            Reporter: Carsten Ziegeler


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (SLING-284) Use bundle context of scripts for service locator aka sling script helper

Posted by Felix Meschberger <fm...@gmail.com>.
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


Re: [jira] Created: (SLING-284) Use bundle context of scripts for service locator aka sling script helper

Posted by Carsten Ziegeler <cz...@apache.org>.
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?

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

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

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [jira] Created: (SLING-284) Use bundle context of scripts for service locator aka sling script helper

Posted by Felix Meschberger <fm...@gmail.com>.
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:

  * What is the bundle context of a script stored in the JCR
repository ?

  * How to get at the bundle context (or the bundle) for scripts
provided by bundles ?

Regards
Felix