Check the versions of the scripting.api and scripting.core bundles. You need versions 2.1.0 and 2.0.14, respectively.
Justin On 11/29/10 3:42 PM, Levine, David wrote: > I've been doing initial development on Day CQ. In order to provide a test > project for the mailing list, I decided to implement this just using > Jackrabbit and Sling alone. When I did that, it worked with no problem > (testing using both Velocity and ESP scripting, although I didn't check > JSPs)! So my assumption is that this is something I will need to talk with > Day/Adobe about... there may be a CQ-specific problem or simply something I > need to do differently. > > When using CQ, I had developed my OSGi bundle with the BindingsValuesProvider > service within CRXDE. For the "standalone" test I just created it using > Maven with the SCR and bundle plugins. As one last test I decided to install > the JAR bundle which worked within Jackrabbit into CQ. It appears to have > installed correctly, but I'm still not getting access to the newly bound > "testData" object. I'll talk to Day. > > Thanks for the offer of help, though! > > --David > > > > -----Original Message----- > From: Justin Edelson [mailto:[email protected]] > Sent: Monday, November 29, 2010 2:15 PM > To: [email protected] > Subject: Re: BindingValuesProvider > > Hi, > > Can you package up a test project demonstrating this? > > Justin > > On 11/29/10 1:53 PM, Levine, David wrote: >> Thanks, Bertrand. >> >> It is odd: my BindingsValuesProvider implementing class is in a separate >> OSGi bundle from the Velocity bundle, and it is defined as a service. I can >> see it in the Felix console - it has a Service ID assigned to it and a >> Component ID. So I would think this is a good thing. But I'm not seeing >> the binding in the scripts. >> >> My class is fairly simple: >> >> /* >> * @scr.component immediate="true" metatype="no" >> * @scr.service >> * >> * @scr.property name="service.description" value="Test Bindings" >> * @scr.property name="service.vendor" value="CU" >> * >> * @scr.property name="javax.script.name" value="any" >> */ >> public class CUBindingsValuesProvider implements BindingsValuesProvider { >> public void addBindings(Bindings bindings) { >> bindings.put("testData","Hello world"); >> } >> } >> >> In my Velocity template I attempt to access it via ${testData} and in JSP I >> attempt to access it via <c:out value="${bindings.testData}"/> but nothing >> shows up in either case. >> >> I have the "javax.script.name" property set to "any", similar to the >> CurrentNodeBindingsValuesProvider example on the wiki. I tried removing the >> property entirely (in case "any" is the incorrect way of specifying this... >> although this is what is done on the wiki page) but it did not help. >> >> --David >> >> >> -----Original Message----- >> From: Bertrand Delacretaz [mailto:[email protected]] >> Sent: Monday, November 29, 2010 1:02 PM >> To: [email protected] >> Subject: Re: BindingValuesProvider >> >> Hi David, >> >> On Mon, Nov 29, 2010 at 6:28 PM, Levine, David <[email protected]> wrote: >>> ...I'd like to now take this a step further and add a few additional >>> scripting variables >>> as discussed here: >>> https://cwiki.apache.org/SLING/adding-new-scripting-variables.html >>> >>> So I want to create a class which implements the BindingsValuesProvider >>> interface. OK... >>> but what do I do with it once I create it?... >> >> There are a few examples in [1] that are used in integration tests [2]. >> >> No configuration is needed - all active OSGi services which implement >> BindingsValuesProvider are used by script engines, and the >> javax.script.name service property can be used to restrict them to a >> specific script engine. I guess the value of that would be "velocity" >> in your case, haven't checked. >> >> -Bertrand >> >> [1] >> http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting >> >> [2] >> http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java >> >> *** >> Scanned >> >> ** >> This e-mail message is intended only for the designated recipient(s) named >> above. The information contained in this e-mail and any attachments may be >> confidential or legally privileged. If you are not the intended recipient, >> you may not review, retain, copy, redistribute or use this e-mail or any >> attachment for any purpose, or disclose all or any part of its contents. If >> you have received this e-mail in error, please immediately notify the sender >> by reply e-mail and permanently delete this e-mail and any attachments from >> your computer system. > > > *** > Scanned > > ** > This e-mail message is intended only for the designated recipient(s) named > above. The information contained in this e-mail and any attachments may be > confidential or legally privileged. If you are not the intended recipient, > you may not review, retain, copy, redistribute or use this e-mail or any > attachment for any purpose, or disclose all or any part of its contents. If > you have received this e-mail in error, please immediately notify the sender > by reply e-mail and permanently delete this e-mail and any attachments from > your computer system.
