You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Markus Pallo <pa...@dig.de> on 2009/07/01 09:49:59 UTC
Re: Script Context custom Bindings for engines
>> i want to inject custom objects to our scripts and did not find a solution
>> to perform the task.
>>
>
> If you´re custom class belongs to an exported package from some
> bundle, just make:
>
> (some_script.esp)
>
> var myCustomObject = new some.package.CustomClass();
>
yes, this works, sametime i have some businessmodels around nodes and
thought about creating and providing them in a more general way for al
scripts.
And so i wondered if it would be a good idea to add to the ScriptContext
Binding some "named" requestattribute map. This could be handled
in DefaultSlingScript.verifyBindings and be added to the scriptBindings.
So everyone could make e.g. a own servlet filter and provide some
variables to scripts ......
>
>> The idea is to provide the scripts with modelWrappers for the current node
>> ...
>>
>> Any suggestions ?
>>
>
> If you mean mapping jcr nodes to domain objects you might want to use
> OCM [1]. You have an example appying OCM at [2].
>
> Hope this helps.
>
we are using jcrom for now, probably will think about replacing them to
ocm, but independendly i have a "businessmodel" wrapping this objects to
handle access to these objects more easy.
> Regards,
>
> Juanjo.
>
> [1] http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/ocm
> [2] http://svn.apache.org/repos/asf/sling/trunk/samples/simple-demo
>
Markus