Hi Janandith, Am Freitag, den 28.03.2008, 19:00 +0600 schrieb janandith jayawardena: > Hi, > I am interested in making Scala language usable in Sling. > I am currently in the process of preparing a Google Summer of Code > proposal to start with.
Cool. I am sure, Bertrand Delacretaz is very interested in seeing Scala inside Sling ;-) > > Please appologise if I'm bothering you. This is the first time I'm > posting to this list. Hey, this is what the list is for. Welcome. > > I have a doubt to clear. > > Under sub directory scripting in Sling home directory there is a > package containing a Script Engine. I assume you are talking of the scripting/api module, which exports the Java Scripting API ? This is in fact the basis for the scripting support in Sling. > As this is used in all other scripting languages available in Sling > ex: Ruby , JavaScript. Is it an interface to integrate scripting > languages to Sling. The Java Scripting API basically defines two interfaces which must be implemented to provide a new script lanugage: The ScriptEngineFactory and the ScriptEngine. The factory is very easy and provides access to the ScriptEngines. The ScriptEngine actually is the integrator of the script language and provides the glue between the Java world and the script world. For a very simple template you might want to look at the Velocity support in the scripting/velocity module. > Is there a standard process to integrate a scripting language to Sling. The main standard process is to write a ScriptEngineFactoy and ScriptEngine for your scripting language, scala in this case. In addition to make it usable in Sling, the package you create must be an OSGi bundle. This can be achieved by using the Maven Bundle Plugin. As a starter, I suggest you look at the Velocity module and adapt the project as needed: * Change the settings in pom.xml * Adapt the ScriptEngine and ScriptEngineFactory classes as appropriate * Change the fully qualified name of the factory class in the META-INF/services/javax.script.ScriptEngineFactory file. That should be it. Hope this helps. Regards Felix
