cancel
Showing results for 
Search instead for 
Did you mean: 

How is the script layer implemented in alfresco ?

zengqingyi12
Champ in-the-making
Champ in-the-making
There is a javascript layer (web script) in alfresco, which can expose the java service to javascript, and it can still make use of javascript's grammar.
I want to know how alfresco implement this script layer, and make it support javascript grammar ?
Any references ?
Thanks in advance !
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
Alfresco uses Mozzila Rhino that provides the Java Script engine that exposes Java Objects through Java Script.   

In addition there's an adapter layer that takes some of the Java APIs and simplifies and converts the Java API into something suitable for Java Script.   The primary example of this is the ScriptNode which among other things exposes properties in a java script freindly manner.

zengqingyi12
Champ in-the-making
Champ in-the-making
Alfresco uses Mozzila Rhino that provides the Java Script engine that exposes Java Objects through Java Script.   

In addition there's an adapter layer that takes some of the Java APIs and simplifies and converts the Java API into something suitable for Java Script.   The primary example of this is the ScriptNode which among other things exposes properties in a java script freindly manner.

Thanks very much ,I just see a Rhino example:

$ cat test.js
java.lang.System.out.println("hi, mom!");
$ java org.mozilla.javascript.tools.jsc.Main test.js
$ ls *.class
test.class
$ java test
hi, mom!
$ java org.mozilla.javascript.tools.jsc.Main -extends java.applet.Applet
    -implements java.lang.Runnable NervousText.js
It seems that are java code inside test.js, it seems we just need to javac test.js(rename to .java)?
Where can I see more deeply examples or references ?   
Thanks!

mrogers
Star Contributor
Star Contributor

zengqingyi12
Champ in-the-making
Champ in-the-making
http://wiki.alfresco.com/wiki/JavaScript_API
Thanks, I am sorry that I overlooked this page. Smiley Very Happy