Hi all, Am Freitag, den 15.02.2008, 17:42 +0100 schrieb Michael Marth: > Hi Felix, > > when I use > var node = resource.adaptTo(Packages.javax.jcr.Node) > I get an exception > "Cannot find function adaptTo". > (I guess this is a temporary problem. Or does it work for you?) > > > > > Which is probably an error as it introduces an API in JavaScript which > > is not paralelled by the other APIs, we should probably remove that .... > > > > Rather than removing the very useful resource.node from esps for consistency > reasons I would kindly ask to introduce resource.node into other scripting > engines as well (would be consistent again :) ).
We probably just cannot do that ;-) In fact, we should adhere to the original API for wrapper classes as much as possible (yes making use of the syntactic possibilities of the respective language) and not introduce new functionality. This is error-prone and not manageable. So the correct thing would really be to remove this from the JavaScript Resource wrapper. > > I believe that this can be done by injecting a node object within the > scripting engine implementation so that the Resource interface does not have > to be changed again. > > I think that this would be really helpful for Sling adoption because it > would make things easier for newbies. I agree with the others that adding a well-known "currentNode" object into the set of global variables for scripts. Regards Felix