Scala in Sling help

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Scala in Sling help

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.

Please appologise if I'm bothering you. This is the first time I'm
posting to this list.

I have a doubt to clear.

Under sub directory scripting in Sling home directory there is a
package containing a Script Engine.
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.
Is there a standard process to integrate a scripting language to Sling.

regards,
Janandith.

( Undergraduate , Department of Computer Science & Engineering ,
  University of Moratuwa,
  Sri lanka. )

Reply | Threaded
Open this post in threaded view
|

Re: Scala in Sling help

Felix Meschberger-2
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


Reply | Threaded
Open this post in threaded view
|

Re: Scala in Sling help

janandith jayawardena
Hi Felix,

Thanks a lot. Really appreciate your advice :-) .

Regards Janandith.

On Fri, Mar 28, 2008 at 9:25 PM, Felix Meschberger <[hidden email]> wrote:

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